@pisell/private-materials 6.6.101 → 6.6.103
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/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/booking/components/footer/utils.js +13 -0
- package/es/components/booking/components/voucher/index.js +42 -3
- package/es/components/booking/info/clientVariant/hooks/useClientFn.js +8 -5
- package/es/components/booking/info/clientVariant/vertical/index.js +1 -1
- package/es/components/booking/info2/service/editService/index.js +31 -11
- package/es/components/booking/info2/service/editService/utils.d.ts +3 -0
- package/es/components/booking/info2/service/editService/utils.js +128 -19
- package/es/components/eftpos/const.d.ts +2 -0
- package/es/components/eftpos/const.js +25 -2
- package/es/components/eftpos/device.d.ts +1 -0
- package/es/components/eftpos/device.js +9 -4
- package/es/components/eftpos/form/index.d.ts +2 -1
- package/es/components/eftpos/form/index.js +7 -2
- package/es/components/eftpos/index.js +5 -0
- package/es/components/eftpos/pos.d.ts +2 -1
- package/es/components/eftpos/pos.js +9 -4
- package/es/components/eftpos/surcharge/index.js +13 -1
- package/es/components/eftposPay/amount.js +20 -5
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +1 -1
- package/es/components/ticketBooking/utils/index.js +4 -4
- package/es/hooks/useCardSurchargeReadOnly.d.ts +4 -0
- package/es/hooks/useCardSurchargeReadOnly.js +61 -0
- package/lib/components/booking/components/footer/utils.js +8 -1
- package/lib/components/booking/components/voucher/index.js +43 -3
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +7 -5
- package/lib/components/booking/info/clientVariant/vertical/index.js +1 -1
- package/lib/components/booking/info2/service/editService/index.js +38 -12
- package/lib/components/booking/info2/service/editService/utils.d.ts +3 -0
- package/lib/components/booking/info2/service/editService/utils.js +94 -12
- package/lib/components/eftpos/const.d.ts +2 -0
- package/lib/components/eftpos/const.js +18 -2
- package/lib/components/eftpos/device.d.ts +1 -0
- package/lib/components/eftpos/device.js +11 -3
- package/lib/components/eftpos/form/index.d.ts +2 -1
- package/lib/components/eftpos/form/index.js +11 -2
- package/lib/components/eftpos/index.js +5 -0
- package/lib/components/eftpos/pos.d.ts +2 -1
- package/lib/components/eftpos/pos.js +15 -3
- package/lib/components/eftpos/surcharge/index.js +41 -8
- package/lib/components/eftposPay/amount.js +26 -3
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +1 -1
- package/lib/components/ticketBooking/utils/index.js +2 -2
- package/lib/hooks/useCardSurchargeReadOnly.d.ts +4 -0
- package/lib/hooks/useCardSurchargeReadOnly.js +86 -0
- package/package.json +4 -4
|
@@ -46,7 +46,9 @@ var CustomFormItem = function CustomFormItem(_ref) {
|
|
|
46
46
|
var formItemList = _ref.formItemList,
|
|
47
47
|
_ref$level = _ref.level,
|
|
48
48
|
level = _ref$level === void 0 ? 0 : _ref$level,
|
|
49
|
-
onChange = _ref.onChange
|
|
49
|
+
onChange = _ref.onChange,
|
|
50
|
+
_ref$surchargeReadOnl = _ref.surchargeReadOnly,
|
|
51
|
+
surchargeReadOnly = _ref$surchargeReadOnl === void 0 ? false : _ref$surchargeReadOnl;
|
|
50
52
|
return /*#__PURE__*/React.createElement(React.Fragment, null, formItemList.map(function (_ref2, index) {
|
|
51
53
|
var __sourceName = _ref2.__sourceName,
|
|
52
54
|
Component = _ref2.Component,
|
|
@@ -55,6 +57,7 @@ var CustomFormItem = function CustomFormItem(_ref) {
|
|
|
55
57
|
return /*#__PURE__*/React.createElement(CustomFormItem, {
|
|
56
58
|
formItemList: item.children,
|
|
57
59
|
onChange: onChange,
|
|
60
|
+
surchargeReadOnly: surchargeReadOnly,
|
|
58
61
|
key: item.name ? "".concat(item.name).concat(level) : "".concat(Component).concat(index).concat(level),
|
|
59
62
|
level: level + 1
|
|
60
63
|
});
|
|
@@ -82,7 +85,9 @@ var CustomFormItem = function CustomFormItem(_ref) {
|
|
|
82
85
|
}
|
|
83
86
|
if (CustomMapping[Component]) {
|
|
84
87
|
var _Comm2 = CustomMapping[Component];
|
|
85
|
-
return /*#__PURE__*/React.createElement(_Comm2, _extends({}, item, {
|
|
88
|
+
return /*#__PURE__*/React.createElement(_Comm2, _extends({}, item, Component === 'Surcharge' ? {
|
|
89
|
+
surchargeReadOnly: surchargeReadOnly
|
|
90
|
+
} : {}, {
|
|
86
91
|
key: "".concat(item.name).concat(level)
|
|
87
92
|
}));
|
|
88
93
|
}
|
|
@@ -32,6 +32,7 @@ import { Eftpos, getCommByFields, DeviceEnum, getDefaultValue, TYPES_WITH_MERCHA
|
|
|
32
32
|
import { Image } from '@pisell/materials';
|
|
33
33
|
import mx51SCISvg from "./assets/mx51SCI.svg";
|
|
34
34
|
import useEngineContext from "../../hooks/useEngineContext";
|
|
35
|
+
import useCardSurchargeReadOnly from "../../hooks/useCardSurchargeReadOnly";
|
|
35
36
|
import { request } from "../../utils";
|
|
36
37
|
import "./index.less";
|
|
37
38
|
locales.init(localeTexts, getLocale());
|
|
@@ -139,6 +140,7 @@ export default (function (props) {
|
|
|
139
140
|
tyroUrl = props.tyroUrl,
|
|
140
141
|
tyroVersion = props.tyroVersion,
|
|
141
142
|
useTyroLog = props.useTyroLog;
|
|
143
|
+
var surchargeReadOnly = useCardSurchargeReadOnly(type);
|
|
142
144
|
// 设置request
|
|
143
145
|
var context = useEngineContext();
|
|
144
146
|
var utils = context.appHelper.utils || {};
|
|
@@ -665,6 +667,7 @@ export default (function (props) {
|
|
|
665
667
|
wrapperClassName: "pisell-lowcode__pos_setting_box"
|
|
666
668
|
}, /*#__PURE__*/React.createElement(Pos, {
|
|
667
669
|
eftposName: name,
|
|
670
|
+
surchargeReadOnly: surchargeReadOnly,
|
|
668
671
|
onSave: onSavePos,
|
|
669
672
|
formItemList: posItemList
|
|
670
673
|
})),
|
|
@@ -683,6 +686,7 @@ export default (function (props) {
|
|
|
683
686
|
wrapperClassName: "pisell-lowcode__pos_box"
|
|
684
687
|
}, /*#__PURE__*/React.createElement(Device, {
|
|
685
688
|
formItemList: deviceItemList,
|
|
689
|
+
surchargeReadOnly: surchargeReadOnly,
|
|
686
690
|
onSave: onSave,
|
|
687
691
|
key: "posdevice".concat(type)
|
|
688
692
|
}, pairStatus ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
@@ -749,6 +753,7 @@ export default (function (props) {
|
|
|
749
753
|
wrapperClassName: "pisell-lowcode__pos_box"
|
|
750
754
|
}, /*#__PURE__*/React.createElement(Device, {
|
|
751
755
|
formItemList: deviceItemList,
|
|
756
|
+
surchargeReadOnly: surchargeReadOnly,
|
|
752
757
|
onSave: onSavePair,
|
|
753
758
|
key: "device".concat(type),
|
|
754
759
|
type: type,
|
|
@@ -2,7 +2,8 @@ import { DeviceProp } from "./const";
|
|
|
2
2
|
interface PosProps {
|
|
3
3
|
eftposName: string;
|
|
4
4
|
formItemList: any[];
|
|
5
|
+
surchargeReadOnly?: boolean;
|
|
5
6
|
onSave: (device: DeviceProp) => void;
|
|
6
7
|
}
|
|
7
|
-
declare const PosForm: ({ onSave, formItemList }: PosProps) => JSX.Element;
|
|
8
|
+
declare const PosForm: ({ onSave, formItemList, surchargeReadOnly, }: PosProps) => JSX.Element;
|
|
8
9
|
export default PosForm;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Form, Button, Typography } from "antd";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { getDefaultValue } from "./const";
|
|
3
|
+
import { getDefaultValue, preserveSurchargeValues } from "./const";
|
|
4
4
|
import { locales } from "@pisell/utils";
|
|
5
5
|
import FormItem from "./form";
|
|
6
6
|
var Title = Typography.Title;
|
|
7
7
|
var PosForm = function PosForm(_ref) {
|
|
8
8
|
var onSave = _ref.onSave,
|
|
9
|
-
formItemList = _ref.formItemList
|
|
9
|
+
formItemList = _ref.formItemList,
|
|
10
|
+
_ref$surchargeReadOnl = _ref.surchargeReadOnly,
|
|
11
|
+
surchargeReadOnly = _ref$surchargeReadOnl === void 0 ? false : _ref$surchargeReadOnl;
|
|
10
12
|
var initialValues = getDefaultValue(formItemList);
|
|
11
13
|
return /*#__PURE__*/React.createElement("div", {
|
|
12
14
|
className: "pisell-lowcode__pos-form-box"
|
|
@@ -15,14 +17,17 @@ var PosForm = function PosForm(_ref) {
|
|
|
15
17
|
className: "pisell-lowcode__pos-title"
|
|
16
18
|
}, locales.getText('page.eftpos.text.setting')), /*#__PURE__*/React.createElement(Form, {
|
|
17
19
|
layout: "vertical",
|
|
18
|
-
onFinish:
|
|
20
|
+
onFinish: function onFinish(values) {
|
|
21
|
+
return onSave(surchargeReadOnly ? preserveSurchargeValues(values, formItemList) : values);
|
|
22
|
+
},
|
|
19
23
|
initialValues: initialValues,
|
|
20
24
|
className: "pisell-lowcode__pos-form",
|
|
21
25
|
key: formItemList
|
|
22
26
|
}, /*#__PURE__*/React.createElement("div", {
|
|
23
27
|
className: "pisell-lowcode__pos-form-content"
|
|
24
28
|
}, /*#__PURE__*/React.createElement(FormItem, {
|
|
25
|
-
formItemList: formItemList
|
|
29
|
+
formItemList: formItemList,
|
|
30
|
+
surchargeReadOnly: surchargeReadOnly
|
|
26
31
|
})), /*#__PURE__*/React.createElement("div", {
|
|
27
32
|
className: "pisell-lowcode__pos-form-btn"
|
|
28
33
|
}, /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -68,7 +68,9 @@ export default (function (props) {
|
|
|
68
68
|
var origin = props.origin,
|
|
69
69
|
top = props.top,
|
|
70
70
|
left = props.left,
|
|
71
|
-
right = props.right
|
|
71
|
+
right = props.right,
|
|
72
|
+
_props$surchargeReadO = props.surchargeReadOnly,
|
|
73
|
+
surchargeReadOnly = _props$surchargeReadO === void 0 ? false : _props$surchargeReadO;
|
|
72
74
|
var leftRef = useRef(left.input.default || 0);
|
|
73
75
|
var rightRef = useRef(right.input.default || 0);
|
|
74
76
|
var _useState = useState(origin.input.defaultValue),
|
|
@@ -90,6 +92,7 @@ export default (function (props) {
|
|
|
90
92
|
* @Date: 2024-08-20 11:12
|
|
91
93
|
*/
|
|
92
94
|
var onValueChange = function onValueChange(e) {
|
|
95
|
+
if (surchargeReadOnly) return;
|
|
93
96
|
setStatus(e.target.value);
|
|
94
97
|
};
|
|
95
98
|
|
|
@@ -99,6 +102,7 @@ export default (function (props) {
|
|
|
99
102
|
* @Date: 2024-08-20 11:13
|
|
100
103
|
*/
|
|
101
104
|
var onChangeRate = function onChangeRate(val) {
|
|
105
|
+
if (surchargeReadOnly) return;
|
|
102
106
|
leftRef.current = val;
|
|
103
107
|
};
|
|
104
108
|
|
|
@@ -108,6 +112,7 @@ export default (function (props) {
|
|
|
108
112
|
* @Date: 2024-08-20 11:13
|
|
109
113
|
*/
|
|
110
114
|
var onChangeMoney = function onChangeMoney(val) {
|
|
115
|
+
if (surchargeReadOnly) return;
|
|
111
116
|
rightRef.current = val;
|
|
112
117
|
};
|
|
113
118
|
|
|
@@ -120,8 +125,10 @@ export default (function (props) {
|
|
|
120
125
|
rules: origin.rules || [],
|
|
121
126
|
style: origin.style || {}
|
|
122
127
|
}, /*#__PURE__*/React.createElement(Radio.Group, {
|
|
128
|
+
disabled: surchargeReadOnly,
|
|
123
129
|
value: origin.input.defaultValue,
|
|
124
130
|
onChange: function onChange(e) {
|
|
131
|
+
if (surchargeReadOnly) return;
|
|
125
132
|
setStatusOrigin(e.target.value);
|
|
126
133
|
}
|
|
127
134
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
@@ -132,6 +139,7 @@ export default (function (props) {
|
|
|
132
139
|
value = item.value,
|
|
133
140
|
other = _objectWithoutProperties(item, _excluded);
|
|
134
141
|
return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
|
|
142
|
+
disabled: surchargeReadOnly || other.disabled,
|
|
135
143
|
value: value,
|
|
136
144
|
key: "".concat(item.value)
|
|
137
145
|
}), label);
|
|
@@ -146,6 +154,7 @@ export default (function (props) {
|
|
|
146
154
|
rules: top.rules || [],
|
|
147
155
|
style: top.style || {}
|
|
148
156
|
}, /*#__PURE__*/React.createElement(Radio.Group, {
|
|
157
|
+
disabled: surchargeReadOnly,
|
|
149
158
|
value: top.input.defaultValue,
|
|
150
159
|
onChange: onValueChange
|
|
151
160
|
}, /*#__PURE__*/React.createElement(Space, {
|
|
@@ -156,6 +165,7 @@ export default (function (props) {
|
|
|
156
165
|
value = item.value,
|
|
157
166
|
other = _objectWithoutProperties(item, _excluded2);
|
|
158
167
|
return /*#__PURE__*/React.createElement(Radio, _extends({}, other, {
|
|
168
|
+
disabled: surchargeReadOnly || other.disabled,
|
|
159
169
|
value: value,
|
|
160
170
|
key: "".concat(item.value)
|
|
161
171
|
}), label);
|
|
@@ -168,6 +178,7 @@ export default (function (props) {
|
|
|
168
178
|
rules: left.rules || [],
|
|
169
179
|
style: left.style || {}
|
|
170
180
|
}, /*#__PURE__*/React.createElement(InputNumber, {
|
|
181
|
+
disabled: surchargeReadOnly,
|
|
171
182
|
min: 0,
|
|
172
183
|
max: 100,
|
|
173
184
|
precision: 2,
|
|
@@ -183,6 +194,7 @@ export default (function (props) {
|
|
|
183
194
|
rules: right.rules || [],
|
|
184
195
|
style: right.style || {}
|
|
185
196
|
}, /*#__PURE__*/React.createElement(InputNumber, {
|
|
197
|
+
disabled: surchargeReadOnly,
|
|
186
198
|
min: 0,
|
|
187
199
|
max: 100000,
|
|
188
200
|
precision: 2,
|
|
@@ -11,14 +11,16 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
11
11
|
import { locales } from '@pisell/utils';
|
|
12
12
|
import { InputNumber, Button, message } from 'antd';
|
|
13
13
|
import { Decimal } from 'decimal.js';
|
|
14
|
-
import React, { useMemo, useState } from 'react';
|
|
14
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
15
15
|
import { useMount } from 'ahooks';
|
|
16
16
|
import Alert from "./component/alert";
|
|
17
17
|
import Titlebar from "./component/header/titlebar";
|
|
18
|
+
import { ModeEnum } from "./const";
|
|
18
19
|
import { getAmonunt } from "./manufacturer";
|
|
19
20
|
import { limitDecimals } from "./helper";
|
|
20
21
|
import { useDispatch, useContextData, updateComponent, updateState } from "./store";
|
|
21
22
|
import payLog from "./utils/payLog";
|
|
23
|
+
import useCardSurchargeReadOnly from "../../hooks/useCardSurchargeReadOnly";
|
|
22
24
|
|
|
23
25
|
/**
|
|
24
26
|
* @title: 支付金额信息配置页
|
|
@@ -45,6 +47,15 @@ export default (function (_ref) {
|
|
|
45
47
|
status = _useState2[0],
|
|
46
48
|
setStatus = _useState2[1];
|
|
47
49
|
var store = useContextData();
|
|
50
|
+
var isPayment = store.mode === ModeEnum.Pay || store.mode === ModeEnum.FullPay;
|
|
51
|
+
var surchargeReadOnly = useCardSurchargeReadOnly(store.eftpos, {
|
|
52
|
+
includePos: isPayment
|
|
53
|
+
});
|
|
54
|
+
var hideSurchargeEdit = isPayment && surchargeReadOnly;
|
|
55
|
+
var isAmountPage = status || hideSurchargeEdit;
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
if (hideSurchargeEdit) setStatus(true);
|
|
58
|
+
}, [hideSurchargeEdit]);
|
|
48
59
|
var _getAmonunt = getAmonunt(store),
|
|
49
60
|
name = _getAmonunt.name,
|
|
50
61
|
symbol = _getAmonunt.symbol,
|
|
@@ -129,6 +140,7 @@ export default (function (_ref) {
|
|
|
129
140
|
var onSubmit = function onSubmit() {
|
|
130
141
|
if (!status) {
|
|
131
142
|
setStatus(true);
|
|
143
|
+
if (surchargeReadOnly) return;
|
|
132
144
|
setSurRate(tempSurRate);
|
|
133
145
|
setSurMoney(tempSurMoney);
|
|
134
146
|
return;
|
|
@@ -185,6 +197,7 @@ export default (function (_ref) {
|
|
|
185
197
|
* @Date: 2024-08-19 09:53
|
|
186
198
|
*/
|
|
187
199
|
var onEdit = function onEdit() {
|
|
200
|
+
if (surchargeReadOnly || useOriginSurcharge) return;
|
|
188
201
|
payLog.log('金额页-点击编辑');
|
|
189
202
|
setStatus(false);
|
|
190
203
|
setTempSurRate(curSurRate);
|
|
@@ -201,7 +214,7 @@ export default (function (_ref) {
|
|
|
201
214
|
}, isMobile ? null : /*#__PURE__*/React.createElement(Titlebar, {
|
|
202
215
|
type: 'left-title-close',
|
|
203
216
|
onClose: onClose
|
|
204
|
-
},
|
|
217
|
+
}, isAmountPage ? name : locales.getText('page.eftpos-pay.text.surcharge.edit.title')), isAmountPage ? /*#__PURE__*/React.createElement("div", {
|
|
205
218
|
className: "pisell-lowcode__eft-pay-amount-body"
|
|
206
219
|
}, /*#__PURE__*/React.createElement("div", {
|
|
207
220
|
className: "pisell-lowcode__eft-pay-cash",
|
|
@@ -239,10 +252,10 @@ export default (function (_ref) {
|
|
|
239
252
|
className: "pisell-lowcode__eft-pay-total"
|
|
240
253
|
}, locales.getText('page.eftpos-pay.text.surcharge.edit.actual.pay'), ":", formatAmount("".concat(total), 2, symbol)), /*#__PURE__*/React.createElement("div", {
|
|
241
254
|
className: "pisell-lowcode__eft-pay-money"
|
|
242
|
-
}, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(totalSurMoney), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", curSurRate, "% + ", formatAmount("".concat(curSurMoney), 2, symbol), ")")), /*#__PURE__*/React.createElement(Button, {
|
|
255
|
+
}, locales.getText('page.eftpos-pay.text.surcharge.edit.inc.surcharge'), ": ", formatAmount("".concat(totalSurMoney), 2, symbol), " (", locales.getText('page.eftpos-pay.text.surcharge.edit.rate'), ":", curSurRate, "% + ", formatAmount("".concat(curSurMoney), 2, symbol), ")")), !hideSurchargeEdit && /*#__PURE__*/React.createElement(Button, {
|
|
243
256
|
type: "link",
|
|
244
257
|
onClick: onEdit,
|
|
245
|
-
disabled: useOriginSurcharge
|
|
258
|
+
disabled: surchargeReadOnly || useOriginSurcharge
|
|
246
259
|
}, locales.getText('page.eftpos-pay.text.surcharge.edit.surcharge')))) : /*#__PURE__*/React.createElement("div", {
|
|
247
260
|
className: "pisell-lowcode__eft-pay-amount-body"
|
|
248
261
|
}, /*#__PURE__*/React.createElement(Alert, null, locales.getText('page.eftpos-pay.text.surcharge.percentage-fixed')), /*#__PURE__*/React.createElement("div", {
|
|
@@ -253,6 +266,7 @@ export default (function (_ref) {
|
|
|
253
266
|
className: "pisell-lowcode__eft-pay-amount-item-title"
|
|
254
267
|
}, locales.getText('page.eftpos-pay.text.surcharge.percentage')), /*#__PURE__*/React.createElement(InputNumber, {
|
|
255
268
|
type: "number",
|
|
269
|
+
disabled: surchargeReadOnly,
|
|
256
270
|
value: tempSurRate,
|
|
257
271
|
min: 0,
|
|
258
272
|
max: 100,
|
|
@@ -270,6 +284,7 @@ export default (function (_ref) {
|
|
|
270
284
|
className: "pisell-lowcode__eft-pay-amount-item-title"
|
|
271
285
|
}, locales.getText('page.eftpos-pay.text.surcharge.fixed')), /*#__PURE__*/React.createElement(InputNumber, {
|
|
272
286
|
type: "number",
|
|
287
|
+
disabled: surchargeReadOnly,
|
|
273
288
|
value: tempSurMoney,
|
|
274
289
|
min: 0,
|
|
275
290
|
max: 100000,
|
|
@@ -292,6 +307,6 @@ export default (function (_ref) {
|
|
|
292
307
|
className: "pisell-lowcode__eft-pay-step-item-btn",
|
|
293
308
|
type: "primary",
|
|
294
309
|
onClick: onSubmit,
|
|
295
|
-
disabled: currentMoney <= 0 &&
|
|
310
|
+
disabled: currentMoney <= 0 && isAmountPage
|
|
296
311
|
}, locales.getText('page.eftpos-pay.text.sure'))));
|
|
297
312
|
});
|
|
@@ -19,7 +19,7 @@ export declare const useStoreRef: <T extends {
|
|
|
19
19
|
readonly netRef: React.MutableRefObject<boolean | undefined>;
|
|
20
20
|
readonly symbolRef: React.MutableRefObject<string>;
|
|
21
21
|
readonly amountRef: React.MutableRefObject<string | number>;
|
|
22
|
-
readonly eftposRef: React.MutableRefObject<"stripe" | "
|
|
22
|
+
readonly eftposRef: React.MutableRefObject<"stripe" | "payo" | "tyro" | "windcave" | "linkly" | "mx51" | "adyenpos" | "huifu" | "adyenalipay" | "adyenwechat">;
|
|
23
23
|
readonly clientRef: React.MutableRefObject<ClientEnum>;
|
|
24
24
|
readonly dataRef: React.MutableRefObject<import("./store").State>;
|
|
25
25
|
};
|
|
@@ -301,7 +301,7 @@ export declare const backUpFree: (payload: Partial<State>) => {
|
|
|
301
301
|
amount?: string | number | undefined;
|
|
302
302
|
mode?: "pay" | "refund" | "fullPay" | "query" | undefined;
|
|
303
303
|
order_id?: string | number | undefined;
|
|
304
|
-
eftpos?: "stripe" | "
|
|
304
|
+
eftpos?: "stripe" | "payo" | "tyro" | "windcave" | "linkly" | "mx51" | "adyenpos" | "huifu" | "adyenalipay" | "adyenwechat" | undefined;
|
|
305
305
|
action?: "pay" | "amount" | "deviceList" | undefined;
|
|
306
306
|
key?: number | undefined;
|
|
307
307
|
step?: number | undefined;
|
|
@@ -161,18 +161,18 @@ export var addService = function addService(list, addItem, state, isMultiDay) {
|
|
|
161
161
|
var isSetCount = false;
|
|
162
162
|
value = list.map(function (item) {
|
|
163
163
|
var _item$_extend;
|
|
164
|
-
//
|
|
164
|
+
// 商品券或多次卡已分配到具体商品行,新增数量需另起一行计算。
|
|
165
165
|
var isGoodPassDiscountProduct = (item.discount_list || []).some(function (item) {
|
|
166
|
-
return item.
|
|
166
|
+
return ['good_pass', 'entitlement_pass'].includes(item.tag || item.type);
|
|
167
167
|
});
|
|
168
168
|
var isEdit = item === null || item === void 0 ? void 0 : item.edit;
|
|
169
|
-
//
|
|
169
|
+
// 子商品是否有商品券或多次卡折扣
|
|
170
170
|
var bundleDiscountList = [];
|
|
171
171
|
((item === null || item === void 0 || (_item$_extend = item._extend) === null || _item$_extend === void 0 || (_item$_extend = _item$_extend.other) === null || _item$_extend === void 0 ? void 0 : _item$_extend.bundle) || []).forEach(function (item) {
|
|
172
172
|
bundleDiscountList.push.apply(bundleDiscountList, _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
|
|
173
173
|
});
|
|
174
174
|
var isGoodPassBundleProduct = bundleDiscountList.some(function (item) {
|
|
175
|
-
return item.
|
|
175
|
+
return ['good_pass', 'entitlement_pass'].includes(item.tag || item.type);
|
|
176
176
|
});
|
|
177
177
|
if (isSameProduct(item, addItem) && !isSetCount && !isGoodPassDiscountProduct && !isEdit && !isGoodPassBundleProduct) {
|
|
178
178
|
var _item$_extend2, _addItem$_extend, _item$_extend3;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
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
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
import useEngineContext from "./useEngineContext";
|
|
9
|
+
var cardEftposTypes = new Set(['payo', 'tyro', 'windcave', 'stripe', 'linkly', 'mx51', 'adyenpos']);
|
|
10
|
+
|
|
11
|
+
/** POS opts in only for payment amount pages; configuration keeps the Shop policy. */
|
|
12
|
+
export default function useCardSurchargeReadOnly(paymentType) {
|
|
13
|
+
var _context$appHelper, _context$appHelper2;
|
|
14
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
15
|
+
_ref$includePos = _ref.includePos,
|
|
16
|
+
includePos = _ref$includePos === void 0 ? false : _ref$includePos;
|
|
17
|
+
var context = useEngineContext();
|
|
18
|
+
var _ref2 = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.constants) || {},
|
|
19
|
+
platform = _ref2.platform;
|
|
20
|
+
var _ref3 = (context === null || context === void 0 || (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils) || {},
|
|
21
|
+
store = _ref3.store,
|
|
22
|
+
getData = _ref3.getData,
|
|
23
|
+
isCardSurchargeReadOnly = _ref3.isCardSurchargeReadOnly;
|
|
24
|
+
var isPosCardPayment = includePos && (platform === 'webpos' || platform === 'pos') && cardEftposTypes.has(paymentType.toLowerCase().replace(/^eftpos_/, ''));
|
|
25
|
+
var getReadOnly = useCallback(function () {
|
|
26
|
+
var _store$getState, _state$core, _state$core2;
|
|
27
|
+
if (platform === 'shop') {
|
|
28
|
+
return typeof isCardSurchargeReadOnly === 'function' && Boolean(isCardSurchargeReadOnly(paymentType));
|
|
29
|
+
}
|
|
30
|
+
if (!isPosCardPayment) return false;
|
|
31
|
+
|
|
32
|
+
// shop_info comes from /shop/shop/show/:id and contains the saved address.
|
|
33
|
+
// Missing or stale shop details keep the entry closed while loading.
|
|
34
|
+
var state = store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 ? void 0 : _store$getState.call(store);
|
|
35
|
+
var shopInfo = (state === null || state === void 0 || (_state$core = state.core) === null || _state$core === void 0 ? void 0 : _state$core.shopInfo) || (getData === null || getData === void 0 ? void 0 : getData('shop_info'));
|
|
36
|
+
var shopId = state === null || state === void 0 || (_state$core2 = state.core) === null || _state$core2 === void 0 || (_state$core2 = _state$core2.core) === null || _state$core2 === void 0 ? void 0 : _state$core2.id;
|
|
37
|
+
if (shopId != null && (shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.id) != null && String(shopId) !== String(shopInfo.id)) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
var countryCode = String((shopInfo === null || shopInfo === void 0 ? void 0 : shopInfo.country_code) || '').toUpperCase();
|
|
41
|
+
return !countryCode || countryCode === 'AU';
|
|
42
|
+
}, [platform, isCardSurchargeReadOnly, paymentType, isPosCardPayment, store, getData]);
|
|
43
|
+
var _useState = useState(getReadOnly),
|
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
+
setReadOnly = _useState2[1];
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
var _store$subscribe;
|
|
48
|
+
if (!isPosCardPayment && (platform !== 'shop' || typeof isCardSurchargeReadOnly !== 'function')) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
var update = function update() {
|
|
52
|
+
return setReadOnly(getReadOnly());
|
|
53
|
+
};
|
|
54
|
+
var unsubscribe = store === null || store === void 0 || (_store$subscribe = store.subscribe) === null || _store$subscribe === void 0 ? void 0 : _store$subscribe.call(store, update);
|
|
55
|
+
update();
|
|
56
|
+
return function () {
|
|
57
|
+
return unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
|
|
58
|
+
};
|
|
59
|
+
}, [store, getReadOnly, platform, isCardSurchargeReadOnly, isPosCardPayment]);
|
|
60
|
+
return getReadOnly();
|
|
61
|
+
}
|
|
@@ -400,7 +400,14 @@ var formatProducts = (item, quantity) => {
|
|
|
400
400
|
});
|
|
401
401
|
const notManualDiscount = discount_list.filter(
|
|
402
402
|
(item2) => item2.type !== "product"
|
|
403
|
-
)
|
|
403
|
+
).map((discount) => {
|
|
404
|
+
var _a2, _b2;
|
|
405
|
+
if (quantity === void 0 || (discount.tag || discount.type) !== "entitlement_pass" || ((_a2 = discount.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id)) {
|
|
406
|
+
return discount;
|
|
407
|
+
}
|
|
408
|
+
const num = Math.min(Number(((_b2 = discount.metadata) == null ? void 0 : _b2.num) ?? item._extend.quantity), quantity);
|
|
409
|
+
return { ...discount, _num: num, metadata: { ...discount.metadata, num } };
|
|
410
|
+
});
|
|
404
411
|
if (item.isCustomItem) {
|
|
405
412
|
item.product_id = 0;
|
|
406
413
|
}
|
|
@@ -87,6 +87,14 @@ var VoucherCard = (props) => {
|
|
|
87
87
|
const { selectCustomer } = (0, import_pisellos.useCustomer)({
|
|
88
88
|
changeCustomerToGlobalState
|
|
89
89
|
});
|
|
90
|
+
(0, import_react.useEffect)(() => {
|
|
91
|
+
var _a2;
|
|
92
|
+
(_a2 = shopDiscount == null ? void 0 : shopDiscount.setEntitlementPassEnabled) == null ? void 0 : _a2.call(shopDiscount, isBooking4Shop);
|
|
93
|
+
return () => {
|
|
94
|
+
var _a3;
|
|
95
|
+
return (_a3 = shopDiscount == null ? void 0 : shopDiscount.setEntitlementPassEnabled) == null ? void 0 : _a3.call(shopDiscount, false);
|
|
96
|
+
};
|
|
97
|
+
}, [shopDiscount, isBooking4Shop]);
|
|
90
98
|
(0, import_ahooks.useDebounceEffect)(
|
|
91
99
|
() => {
|
|
92
100
|
if (isBooking4Shop) {
|
|
@@ -332,12 +340,44 @@ var VoucherCard = (props) => {
|
|
|
332
340
|
};
|
|
333
341
|
const availableData = (0, import_react.useMemo)(() => {
|
|
334
342
|
if (!isBooking4Shop) return [];
|
|
335
|
-
return discountList.filter((item) => !!item.isAvailable).
|
|
336
|
-
|
|
343
|
+
return discountList.filter((item) => !!item.isAvailable).flatMap((discount) => {
|
|
344
|
+
var _a2, _b2, _c2;
|
|
345
|
+
const currentRow = {
|
|
337
346
|
...discount,
|
|
338
|
-
|
|
347
|
+
// 原卡片仍读取 isSelected,历史扣次不代表本次勾选。
|
|
348
|
+
isSelected: discount.tag === "entitlement_pass" && !discount.isDisabled ? !!discount.isSelected && (((_a2 = discount.appliedProductDetails) == null ? void 0 : _a2.length) || 0) > (((_b2 = discount.committedAppliedProductDetails) == null ? void 0 : _b2.length) || 0) : discount.isSelected,
|
|
349
|
+
isDisabled: discount.isDisabled || (discount.tag === "entitlement_pass" ? !discount.isAvailable : discount.isDisabledForProductUsed) || disabled,
|
|
339
350
|
savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice(discount)
|
|
340
351
|
};
|
|
352
|
+
const committedDetails = discount.tag === "entitlement_pass" ? discount.committedAppliedProductDetails || [] : [];
|
|
353
|
+
if (!committedDetails.length) return [currentRow];
|
|
354
|
+
const historyRow = {
|
|
355
|
+
...discount,
|
|
356
|
+
displayKey: `${discount.id}-last-settlement`,
|
|
357
|
+
isEditMode: true,
|
|
358
|
+
isSelected: true,
|
|
359
|
+
isDisabled: true,
|
|
360
|
+
appliedProductDetails: committedDetails,
|
|
361
|
+
savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice({
|
|
362
|
+
...discount,
|
|
363
|
+
savedAmount: 0,
|
|
364
|
+
appliedProductDetails: committedDetails
|
|
365
|
+
})
|
|
366
|
+
};
|
|
367
|
+
const currentDetails = (discount.appliedProductDetails || []).slice(committedDetails.length);
|
|
368
|
+
const canApplyToNewProducts = !discount.isDisabled && (((_c2 = discount.applicableProductDetails) == null ? void 0 : _c2.length) || 0) > 0;
|
|
369
|
+
if (!currentDetails.length && !canApplyToNewProducts) return [historyRow];
|
|
370
|
+
return [historyRow, {
|
|
371
|
+
...currentRow,
|
|
372
|
+
displayKey: `${discount.id}-current`,
|
|
373
|
+
isEditMode: false,
|
|
374
|
+
appliedProductDetails: currentDetails,
|
|
375
|
+
savedAmount: shopDiscount.calcDiscountApplicableProductTotalPrice({
|
|
376
|
+
...discount,
|
|
377
|
+
savedAmount: 0,
|
|
378
|
+
appliedProductDetails: currentDetails
|
|
379
|
+
})
|
|
380
|
+
}];
|
|
341
381
|
});
|
|
342
382
|
}, [discountList, isBooking4Shop, disabled]);
|
|
343
383
|
if (!isBooking4Shop) return null;
|
|
@@ -52,7 +52,7 @@ var useClientFn = (_params) => {
|
|
|
52
52
|
num: 5,
|
|
53
53
|
total: 0,
|
|
54
54
|
search: "",
|
|
55
|
-
with: ["
|
|
55
|
+
with: ["contactsInfo"],
|
|
56
56
|
relation_form_id: (_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id
|
|
57
57
|
});
|
|
58
58
|
const paramsRef = (0, import_react.useRef)(params);
|
|
@@ -77,7 +77,7 @@ var useClientFn = (_params) => {
|
|
|
77
77
|
customer_ids,
|
|
78
78
|
...resetParams
|
|
79
79
|
}, returnResult) => {
|
|
80
|
-
var _a2, _b2;
|
|
80
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
81
81
|
let _setLoading;
|
|
82
82
|
if (resetParams.skip === 1) {
|
|
83
83
|
if (resetParams.search) {
|
|
@@ -100,7 +100,9 @@ var useClientFn = (_params) => {
|
|
|
100
100
|
...resetParams.search ? { num: 10 } : {},
|
|
101
101
|
...state.isFranchisee ? { franchisee_customer_ids: customer_ids } : { customer_ids },
|
|
102
102
|
...!state.isFranchisee && !returnResult ? { _config: { abort: true } } : {},
|
|
103
|
-
with: withKey
|
|
103
|
+
with: withKey,
|
|
104
|
+
with_form_records: 1,
|
|
105
|
+
relation_form_id: (_f2 = (_e2 = (_d2 = (_c2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _c2.config) == null ? void 0 : _d2.basic) == null ? void 0 : _e2.appointment_subject) == null ? void 0 : _f2.form_id
|
|
104
106
|
});
|
|
105
107
|
const list = ((data == null ? void 0 : data.list) || []).map((d) => {
|
|
106
108
|
var _a3;
|
|
@@ -108,9 +110,9 @@ var useClientFn = (_params) => {
|
|
|
108
110
|
...d,
|
|
109
111
|
name: getNickname(d),
|
|
110
112
|
id: d.franchisee_customer_id || d.id,
|
|
111
|
-
form_record: ((_a3 = d.
|
|
112
|
-
...item,
|
|
113
|
+
form_record: ((_a3 = d.form_record_list) == null ? void 0 : _a3.map((item) => ({
|
|
113
114
|
...item.data,
|
|
115
|
+
...item,
|
|
114
116
|
form_record_id: item.id
|
|
115
117
|
}))) || []
|
|
116
118
|
};
|
|
@@ -282,7 +282,7 @@ var VerticalClient = (0, import_react.forwardRef)((props, ref) => {
|
|
|
282
282
|
} else {
|
|
283
283
|
const val = await getClients(
|
|
284
284
|
{
|
|
285
|
-
with: ["
|
|
285
|
+
with: ["contactsInfo"],
|
|
286
286
|
relation_form_id: boardConfig == null ? void 0 : boardConfig.form_id,
|
|
287
287
|
skip: 1,
|
|
288
288
|
num: 20,
|