@pisell/private-materials 3.0.28 → 3.0.30
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/components/collapsibleList/index.js +1 -1
- package/es/components/booking/components/footer/utils.js +5 -1
- package/es/components/booking/deposit/ClientItem/index.d.ts +18 -0
- package/es/components/booking/deposit/ClientItem/index.js +43 -0
- package/es/components/booking/deposit/ClientItem/index.less +37 -0
- package/es/components/booking/deposit/DepositItem/index.d.ts +20 -0
- package/es/components/booking/deposit/DepositItem/index.js +105 -0
- package/es/components/booking/deposit/DepositItem/index.less +88 -0
- package/es/components/booking/deposit/EditDepositModal/index.d.ts +9 -0
- package/es/components/booking/deposit/EditDepositModal/index.js +126 -0
- package/es/components/booking/deposit/EditDepositModal/index.less +24 -0
- package/es/components/booking/deposit/index.d.ts +3 -0
- package/es/components/booking/deposit/index.js +164 -0
- package/es/components/booking/deposit/index.less +3 -0
- package/es/components/booking/deposit/serve.d.ts +8 -0
- package/es/components/booking/deposit/serve.js +27 -0
- package/es/components/booking/forms/index.js +2 -1
- package/es/components/booking/info/service/addService/index.js +2 -2
- package/es/components/booking/info/service/editService/index.js +50 -21
- package/es/components/booking/locales.d.ts +54 -0
- package/es/components/booking/locales.js +57 -3
- package/es/components/booking/utils.d.ts +37 -0
- package/es/components/booking/utils.js +71 -8
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/components/booking/components/collapsibleList/index.js +1 -1
- package/lib/components/booking/components/footer/utils.js +4 -1
- package/lib/components/booking/deposit/ClientItem/index.d.ts +18 -0
- package/lib/components/booking/deposit/ClientItem/index.js +71 -0
- package/lib/components/booking/deposit/ClientItem/index.less +37 -0
- package/lib/components/booking/deposit/DepositItem/index.d.ts +20 -0
- package/lib/components/booking/deposit/DepositItem/index.js +112 -0
- package/lib/components/booking/deposit/DepositItem/index.less +88 -0
- package/lib/components/booking/deposit/EditDepositModal/index.d.ts +9 -0
- package/lib/components/booking/deposit/EditDepositModal/index.js +131 -0
- package/lib/components/booking/deposit/EditDepositModal/index.less +24 -0
- package/lib/components/booking/deposit/index.d.ts +3 -0
- package/lib/components/booking/deposit/index.js +186 -0
- package/lib/components/booking/deposit/index.less +3 -0
- package/lib/components/booking/deposit/serve.d.ts +8 -0
- package/lib/components/booking/deposit/serve.js +30 -0
- package/lib/components/booking/forms/index.js +1 -1
- package/lib/components/booking/info/service/addService/index.js +2 -2
- package/lib/components/booking/info/service/editService/index.js +33 -11
- package/lib/components/booking/locales.d.ts +54 -0
- package/lib/components/booking/locales.js +57 -3
- package/lib/components/booking/utils.d.ts +37 -0
- package/lib/components/booking/utils.js +33 -10
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lowcode/booking-deposit/meta.ts +93 -0
- package/package.json +3 -3
|
@@ -77,7 +77,7 @@ var CollapsibleList = function CollapsibleList(props) {
|
|
|
77
77
|
arr = arr.slice(0, _maxLimit);
|
|
78
78
|
}
|
|
79
79
|
return arr;
|
|
80
|
-
}, [list
|
|
80
|
+
}, [list, maxLimit]);
|
|
81
81
|
return /*#__PURE__*/React.createElement("div", {
|
|
82
82
|
className: classNames("pisell2-collapsible-list-wrap", className),
|
|
83
83
|
style: style
|
|
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
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; }
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
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); }
|
|
7
|
-
import { flexibleObj } from "../../utils";
|
|
7
|
+
import { flexibleObj, isNowTime, getNowTime } from "../../utils";
|
|
8
8
|
import { isWalkIn } from "../../utils";
|
|
9
9
|
var formatNote = function formatNote(data) {
|
|
10
10
|
var _data$notes;
|
|
@@ -90,6 +90,10 @@ var formatBookings = function formatBookings(data) {
|
|
|
90
90
|
var end_date = item._extend.endDate.format('YYYY-MM-DD');
|
|
91
91
|
var end_time = item._extend.endDate.format("HH:mm");
|
|
92
92
|
var start_time = item._extend.startDate.format("HH:mm");
|
|
93
|
+
// 更新当前时间
|
|
94
|
+
if (isNowTime(item._extend.start_time)) {
|
|
95
|
+
start_time = getNowTime();
|
|
96
|
+
}
|
|
93
97
|
var total = Number(item._extend.total);
|
|
94
98
|
var origin_total = Number(item._extend.origin_total);
|
|
95
99
|
var discount_amount = origin_total - total;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
declare type ClientItemProps = {
|
|
4
|
+
data: {
|
|
5
|
+
cover: string;
|
|
6
|
+
name: string;
|
|
7
|
+
display_name: string;
|
|
8
|
+
nickname: string;
|
|
9
|
+
email: string;
|
|
10
|
+
phone: string;
|
|
11
|
+
};
|
|
12
|
+
coverSize?: number;
|
|
13
|
+
style?: React.CSSProperties;
|
|
14
|
+
className?: string;
|
|
15
|
+
walkInName?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const ClientItem: (props: ClientItemProps) => React.JSX.Element;
|
|
18
|
+
export default ClientItem;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { useCallback } from "react";
|
|
2
|
+
import { Avatar } from "antd";
|
|
3
|
+
import { image, locales } from "@pisell/utils";
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import User01 from "@pisell/icon/src/User01";
|
|
6
|
+
import { isWalkIn as getIsWalkIn } from "../../utils";
|
|
7
|
+
import "./index.less";
|
|
8
|
+
var ClientItem = function ClientItem(props) {
|
|
9
|
+
var data = props.data,
|
|
10
|
+
_props$coverSize = props.coverSize,
|
|
11
|
+
coverSize = _props$coverSize === void 0 ? 48 : _props$coverSize,
|
|
12
|
+
style = props.style,
|
|
13
|
+
className = props.className,
|
|
14
|
+
walkInName = props.walkInName;
|
|
15
|
+
var getNickname = useCallback(function (item) {
|
|
16
|
+
if (getIsWalkIn(item === null || item === void 0 ? void 0 : item.id)) {
|
|
17
|
+
return walkInName || locales.getText("pisell2.text.select-a-customer");
|
|
18
|
+
}
|
|
19
|
+
return item.name || (item.display_name || "").trim() || (item.nickname || "").trim() || "";
|
|
20
|
+
}, [locales.localeMap]);
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
style: style,
|
|
23
|
+
className: classnames("pisell-lowcode__client-item", className)
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
25
|
+
className: "pisell-lowcode__client-item-avatar",
|
|
26
|
+
src: image.ali(data === null || data === void 0 ? void 0 : data.cover, 100) || undefined,
|
|
27
|
+
size: coverSize,
|
|
28
|
+
icon: /*#__PURE__*/React.createElement(User01, {
|
|
29
|
+
className: "pisell-lowcode__client-item-avatar-icon"
|
|
30
|
+
})
|
|
31
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "pisell-lowcode__client-item-info"
|
|
33
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: "pisell-lowcode__client-item-info-name"
|
|
35
|
+
}, getNickname(data)), /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "pisell-lowcode__client-item-info-desc"
|
|
37
|
+
}, data !== null && data !== void 0 && data.email ? /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: ""
|
|
39
|
+
}, data === null || data === void 0 ? void 0 : data.email) : null, data !== null && data !== void 0 && data.phone ? /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: ""
|
|
41
|
+
}, data === null || data === void 0 ? void 0 : data.phone) : null)));
|
|
42
|
+
};
|
|
43
|
+
export default ClientItem;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.pisell-lowcode__client-item {
|
|
2
|
+
width: 100%;
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: 10px;
|
|
5
|
+
position: relative;
|
|
6
|
+
align-items: center;
|
|
7
|
+
padding: 0 20px;
|
|
8
|
+
.pisell-lowcode__client-item-avatar {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
background: var(--gray-100, #F2F4F7);
|
|
13
|
+
.pisell-lowcode__client-item-avatar-icon {
|
|
14
|
+
font-size: 24px;
|
|
15
|
+
color: #475467;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
.pisell-lowcode__client-item-info {
|
|
19
|
+
flex: 1;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
.pisell-lowcode__client-item-info-name {
|
|
23
|
+
color: var(--text-text-1, #1B1B1B);
|
|
24
|
+
font-size: 16px;
|
|
25
|
+
font-style: normal;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
line-height: 22px;
|
|
28
|
+
}
|
|
29
|
+
.pisell-lowcode__client-item-info-desc {
|
|
30
|
+
color: var(--text-text-2, #777);
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
line-height: 20px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
declare type DepositItemProps = {
|
|
4
|
+
status: "paid" | "unpaid";
|
|
5
|
+
onEdit: React.MouseEventHandler<HTMLSpanElement>;
|
|
6
|
+
customer: any;
|
|
7
|
+
totalAmountStr: string;
|
|
8
|
+
totalAmount: number;
|
|
9
|
+
orderId: number;
|
|
10
|
+
orderNumber: number;
|
|
11
|
+
handleGoOrderDetail: () => void;
|
|
12
|
+
generatePaymentLink: (orderId: number) => void;
|
|
13
|
+
depositAmount: number;
|
|
14
|
+
amountSymbol: string;
|
|
15
|
+
createdTime: string;
|
|
16
|
+
isPaid: boolean;
|
|
17
|
+
isBookingCancelled: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare const DepositItem: (props: DepositItemProps) => React.JSX.Element;
|
|
20
|
+
export default DepositItem;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { Button, Dropdown } from "antd";
|
|
3
|
+
import { DownOutlined } from "@ant-design/icons";
|
|
4
|
+
import { formatAmount, locales } from "@pisell/utils";
|
|
5
|
+
import ClientItem from "../ClientItem";
|
|
6
|
+
import Edit05 from "@pisell/icon/src/Edit05";
|
|
7
|
+
import "./index.less";
|
|
8
|
+
var statusTagColor = {
|
|
9
|
+
unpaid: "#B2DDFF",
|
|
10
|
+
paid: "#ABEFC6"
|
|
11
|
+
};
|
|
12
|
+
var statusBgColor = {
|
|
13
|
+
unpaid: "#EFF8FF",
|
|
14
|
+
paid: "#ECFDF3"
|
|
15
|
+
};
|
|
16
|
+
var DepositItem = function DepositItem(props) {
|
|
17
|
+
var status = props.status,
|
|
18
|
+
customer = props.customer,
|
|
19
|
+
totalAmountStr = props.totalAmountStr,
|
|
20
|
+
onEdit = props.onEdit,
|
|
21
|
+
orderId = props.orderId,
|
|
22
|
+
orderNumber = props.orderNumber,
|
|
23
|
+
handleGoOrderDetail = props.handleGoOrderDetail,
|
|
24
|
+
generatePaymentLink = props.generatePaymentLink,
|
|
25
|
+
depositAmount = props.depositAmount,
|
|
26
|
+
amountSymbol = props.amountSymbol,
|
|
27
|
+
createdTime = props.createdTime,
|
|
28
|
+
isPaid = props.isPaid,
|
|
29
|
+
isBookingCancelled = props.isBookingCancelled;
|
|
30
|
+
var statusText = {
|
|
31
|
+
unpaid: locales.getText("pisell2.text.deposit-item-status-unpaid"),
|
|
32
|
+
paid: locales.getText("pisell2.text.deposit-item-status-paid")
|
|
33
|
+
};
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
document.body.id = "body";
|
|
36
|
+
}, []);
|
|
37
|
+
var items = [{
|
|
38
|
+
key: "1",
|
|
39
|
+
disabled: isPaid || isBookingCancelled,
|
|
40
|
+
label: /*#__PURE__*/React.createElement("div", null, locales.getText("pisell2.text.deposit-generate-payment-link"))
|
|
41
|
+
}
|
|
42
|
+
// {
|
|
43
|
+
// key: "2",
|
|
44
|
+
// label: <div>发送邮件</div>,
|
|
45
|
+
// },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
var onClick = function onClick(_ref) {
|
|
49
|
+
var key = _ref.key;
|
|
50
|
+
if (key === '1') {
|
|
51
|
+
generatePaymentLink === null || generatePaymentLink === void 0 ? void 0 : generatePaymentLink(orderId);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "pisell-lowcode__deposit-item"
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: "pisell-lowcode__deposit-item-header",
|
|
58
|
+
style: {
|
|
59
|
+
backgroundColor: statusBgColor[status]
|
|
60
|
+
}
|
|
61
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: "pisell-lowcode__deposit-status",
|
|
63
|
+
style: {
|
|
64
|
+
backgroundColor: statusTagColor[status]
|
|
65
|
+
}
|
|
66
|
+
}, statusText[status]), /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: "pisell-lowcode__deposit-item-header-right"
|
|
68
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
69
|
+
className: "pisell-lowcode__deposit-item-header-right-amount"
|
|
70
|
+
}, formatAmount(depositAmount, 2, amountSymbol)), !(isPaid || isBookingCancelled) && /*#__PURE__*/React.createElement(Edit05, {
|
|
71
|
+
className: "pisell-lowcode__deposit-item-header-right-edit",
|
|
72
|
+
onClick: onEdit
|
|
73
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "pisell-lowcode__deposit-item-content"
|
|
75
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "pisell-lowcode__deposit-item-content-line1"
|
|
77
|
+
}, locales.getText("pisell2.text.deposit-order-no"), " ", orderNumber), /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: "pisell-lowcode__deposit-item-content-line2"
|
|
79
|
+
}, createdTime), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ClientItem, {
|
|
80
|
+
data: customer,
|
|
81
|
+
coverSize: 40,
|
|
82
|
+
walkInName: "Walk-In"
|
|
83
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "pisell-lowcode__deposit-item-footer"
|
|
85
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: "pisell-lowcode__deposit-item-footer-total"
|
|
87
|
+
}, /*#__PURE__*/React.createElement("div", null, locales.getText("pisell2.text.deposit-order-total")), /*#__PURE__*/React.createElement("div", null, totalAmountStr)), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "pisell-lowcode__deposit-item-footer-action"
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
90
|
+
block: true,
|
|
91
|
+
size: "large",
|
|
92
|
+
onClick: handleGoOrderDetail
|
|
93
|
+
}, locales.getText("pisell2.text.deposit-order-detail")), /*#__PURE__*/React.createElement(Dropdown, {
|
|
94
|
+
menu: {
|
|
95
|
+
items: items,
|
|
96
|
+
onClick: onClick
|
|
97
|
+
},
|
|
98
|
+
placement: "bottom"
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
100
|
+
block: true,
|
|
101
|
+
type: "primary",
|
|
102
|
+
size: "large"
|
|
103
|
+
}, locales.getText("pisell2.text.deposit-collect-deposit"), " ", /*#__PURE__*/React.createElement(DownOutlined, null))))));
|
|
104
|
+
};
|
|
105
|
+
export default DepositItem;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.pisell-lowcode__deposit-item {
|
|
2
|
+
border-radius: 12px;
|
|
3
|
+
border: 1px solid var(--Gray-300, #D0D5DD);
|
|
4
|
+
background: var(--Base-White, #FFF);
|
|
5
|
+
box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.10), 0px 1px 2px 0px rgba(16, 24, 40, 0.06);
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
.pisell-lowcode__deposit-item-header {
|
|
8
|
+
background: var(--Blue-50, #EFF8FF);
|
|
9
|
+
display: flex;
|
|
10
|
+
padding: 20px;
|
|
11
|
+
.pisell-lowcode__deposit-status {
|
|
12
|
+
display: flex;
|
|
13
|
+
padding: 6px 16px;
|
|
14
|
+
align-items: center;
|
|
15
|
+
border-radius: 16px;
|
|
16
|
+
color: var(--Base-Black, #000);
|
|
17
|
+
text-align: center;
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
font-style: normal;
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
line-height: 20px; /* 142.857% */
|
|
22
|
+
}
|
|
23
|
+
.pisell-lowcode__deposit-item-header-right {
|
|
24
|
+
flex: 1;
|
|
25
|
+
text-align: right;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: flex-end;
|
|
29
|
+
.pisell-lowcode__deposit-item-header-right-amount {
|
|
30
|
+
color: var(--Warning-600, #DC6803);
|
|
31
|
+
font-size: 20px;
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
line-height: 30px; /* 150% */
|
|
35
|
+
margin-right: 8px;
|
|
36
|
+
}
|
|
37
|
+
.pisell-lowcode__deposit-item-header-right-edit{
|
|
38
|
+
font-size: 24px;
|
|
39
|
+
color: #1570EF;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.pisell-lowcode__deposit-item-content {
|
|
45
|
+
border-top: 1px solid #EAECF0;
|
|
46
|
+
border-bottom: 1px solid #EAECF0;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 32px;
|
|
51
|
+
padding: 32px 0;
|
|
52
|
+
.pisell-lowcode__deposit-item-content-line1 {
|
|
53
|
+
color: var(--Gray-600, #475467);
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
font-style: normal;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
line-height: 20px; /* 142.857% */
|
|
58
|
+
}
|
|
59
|
+
.pisell-lowcode__deposit-item-content-line2 {
|
|
60
|
+
color: #000;
|
|
61
|
+
font-size: 16px;
|
|
62
|
+
font-style: normal;
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
line-height: 24px; /* 150% */
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
.pisell-lowcode__deposit-item-footer {
|
|
68
|
+
padding: 20px;
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
gap: 20px;
|
|
72
|
+
.pisell-lowcode__deposit-item-footer-total {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: space-between;
|
|
75
|
+
|
|
76
|
+
color: var(--Gray-900, #101828);
|
|
77
|
+
text-align: right;
|
|
78
|
+
font-size: 16px;
|
|
79
|
+
font-style: normal;
|
|
80
|
+
font-weight: 400;
|
|
81
|
+
line-height: 24px; /* 150% */
|
|
82
|
+
}
|
|
83
|
+
.pisell-lowcode__deposit-item-footer-action {
|
|
84
|
+
display: flex;
|
|
85
|
+
gap: 20px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
declare type EditDepositModalProps = {
|
|
4
|
+
amountSymbol: string;
|
|
5
|
+
onChange: (amount: number) => void;
|
|
6
|
+
totalAmount: number;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<EditDepositModalProps & React.RefAttributes<unknown>>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
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); }
|
|
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
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { InputNumber, message, Modal } from "antd";
|
|
10
|
+
import "./index.less";
|
|
11
|
+
import { locales } from "@pisell/utils";
|
|
12
|
+
var EditDepositModal = function EditDepositModal(props, ref) {
|
|
13
|
+
var onChange = props.onChange,
|
|
14
|
+
amountSymbol = props.amountSymbol,
|
|
15
|
+
totalAmount = props.totalAmount;
|
|
16
|
+
var _useState = useState(false),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
open = _useState2[0],
|
|
19
|
+
setOpen = _useState2[1];
|
|
20
|
+
var _useState3 = useState("1"),
|
|
21
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
22
|
+
depositMode = _useState4[0],
|
|
23
|
+
setDepositMode = _useState4[1];
|
|
24
|
+
var _useState5 = useState(null),
|
|
25
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
26
|
+
amount = _useState6[0],
|
|
27
|
+
setAmount = _useState6[1];
|
|
28
|
+
var inputNumberRef = useRef(null);
|
|
29
|
+
var options = [{
|
|
30
|
+
label: "固定金额",
|
|
31
|
+
value: "1"
|
|
32
|
+
}
|
|
33
|
+
// { label: "订单百分比", value: "2" },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
var onAmountChange = function onAmountChange(value) {
|
|
37
|
+
setAmount(value);
|
|
38
|
+
};
|
|
39
|
+
var amountProps = useMemo(function () {
|
|
40
|
+
if (depositMode === "1") {
|
|
41
|
+
return {
|
|
42
|
+
prefix: amountSymbol
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
min: 0,
|
|
47
|
+
max: 100,
|
|
48
|
+
addonAfter: "%"
|
|
49
|
+
};
|
|
50
|
+
}, [depositMode]);
|
|
51
|
+
var handleOk = function handleOk() {
|
|
52
|
+
if (amount === 0) {
|
|
53
|
+
return message.error(locales.getText("pisell2.text.deposit-amount-message"));
|
|
54
|
+
}
|
|
55
|
+
if (!amount) {
|
|
56
|
+
return message.error(locales.getText("pisell2.text.deposit-amount-message3"));
|
|
57
|
+
}
|
|
58
|
+
if (amount > totalAmount) {
|
|
59
|
+
return message.error(locales.getText("pisell2.text.deposit-amount-message2"));
|
|
60
|
+
}
|
|
61
|
+
onChange(amount);
|
|
62
|
+
setOpen(false);
|
|
63
|
+
};
|
|
64
|
+
var handleOpenChange = function handleOpenChange(val) {
|
|
65
|
+
setOpen(val);
|
|
66
|
+
};
|
|
67
|
+
useEffect(function () {
|
|
68
|
+
if (open) {
|
|
69
|
+
setTimeout(function () {
|
|
70
|
+
var _inputNumberRef$curre;
|
|
71
|
+
(_inputNumberRef$curre = inputNumberRef.current) === null || _inputNumberRef$curre === void 0 ? void 0 : _inputNumberRef$curre.focus();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}, [open]);
|
|
75
|
+
useImperativeHandle(ref, function () {
|
|
76
|
+
return {
|
|
77
|
+
handleOpen: function handleOpen(amount) {
|
|
78
|
+
if (amount) {
|
|
79
|
+
setAmount(amount);
|
|
80
|
+
}
|
|
81
|
+
handleOpenChange(true);
|
|
82
|
+
},
|
|
83
|
+
handleClose: function handleClose() {
|
|
84
|
+
return handleOpenChange(false);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
var onCancel = function onCancel() {
|
|
89
|
+
handleOpenChange(false);
|
|
90
|
+
setAmount(null);
|
|
91
|
+
};
|
|
92
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
93
|
+
open: open,
|
|
94
|
+
width: 400,
|
|
95
|
+
cancelButtonProps: {
|
|
96
|
+
block: true,
|
|
97
|
+
size: "large"
|
|
98
|
+
},
|
|
99
|
+
okButtonProps: {
|
|
100
|
+
block: true,
|
|
101
|
+
size: "large"
|
|
102
|
+
},
|
|
103
|
+
className: "pisell-lowcode__edit-deposit-modal",
|
|
104
|
+
title: locales.getText("pisell2.text.deposit-deposit-amount"),
|
|
105
|
+
onCancel: onCancel,
|
|
106
|
+
onOk: handleOk,
|
|
107
|
+
destroyOnClose: true
|
|
108
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
109
|
+
className: "pisell-lowcode__edit-deposit-modal-field-list"
|
|
110
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
111
|
+
className: "pisell-lowcode__edit-deposit-modal-field"
|
|
112
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
113
|
+
className: "pisell-lowcode__edit-deposit-modal-field-label"
|
|
114
|
+
}, locales.getText("pisell2.text.deposit-amount")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
115
|
+
ref: inputNumberRef,
|
|
116
|
+
style: {
|
|
117
|
+
width: "100%"
|
|
118
|
+
},
|
|
119
|
+
onChange: onAmountChange,
|
|
120
|
+
value: amount,
|
|
121
|
+
size: "large",
|
|
122
|
+
min: 0,
|
|
123
|
+
precision: 2
|
|
124
|
+
}, amountProps))))));
|
|
125
|
+
};
|
|
126
|
+
export default /*#__PURE__*/forwardRef(EditDepositModal);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.pisell-lowcode__edit-deposit-modal {
|
|
2
|
+
.pisell-lowcode-modal-footer {
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: 12px;
|
|
5
|
+
}
|
|
6
|
+
.pisell-lowcode__edit-deposit-modal-field-list {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 20px;
|
|
10
|
+
margin-bottom: 32px;
|
|
11
|
+
}
|
|
12
|
+
.pisell-lowcode__edit-deposit-modal-field {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 6px;
|
|
16
|
+
.pisell-lowcode__edit-deposit-modal-field-label {
|
|
17
|
+
color: var(--Gray-700, #344054);
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
font-style: normal;
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
line-height: 20px; /* 142.857% */
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|