@pisell/private-materials 6.5.4 → 6.5.6
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 +160 -146
- 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 +9 -9
- package/es/components/booking/addons/model.d.ts +1 -10
- package/es/components/booking/components/actionButtons/index.js +37 -42
- package/es/components/booking/components/actionButtons/index.less +0 -28
- package/es/components/booking/components/footer/amount.d.ts +3 -3
- package/es/components/booking/components/footer/amount.js +51 -31
- package/es/components/booking/components/footer/index.js +177 -68
- package/es/components/booking/components/footer/utils.js +62 -33
- package/es/components/booking/forms/model.d.ts +1 -10
- package/es/components/booking/info/model.d.ts +1 -10
- package/es/components/booking/info/model.js +5 -0
- package/es/components/booking/info/service/addService/index.js +2 -1
- package/es/components/booking/info/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/info2/index.js +42 -2
- package/es/components/booking/info2/service/addService/index.js +2 -1
- package/es/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/es/components/booking/info2/service/editService/index.js +12 -4
- package/es/components/booking/model.d.ts +1 -9
- package/es/components/booking/notes/model.d.ts +1 -10
- package/es/components/booking/payments/model.d.ts +1 -10
- package/es/components/booking/utils.js +10 -5
- package/es/components/checkout/PaymentModal.d.ts +2 -0
- package/es/components/checkout/PaymentModal.js +462 -263
- package/es/components/checkout/components/AdditionalModule/index.less +1 -1
- package/es/components/checkout/components/AmountSummary/index.js +176 -65
- package/es/components/checkout/components/AmountSummary/index.less +13 -0
- package/es/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
- package/es/components/checkout/components/CashPaymentModule/index.js +110 -132
- package/es/components/checkout/components/CashPaymentModule/index.less +200 -176
- package/es/components/checkout/components/PaymentDetailModal/index.js +2 -2
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
- package/es/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +214 -0
- package/es/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
- package/es/components/checkout/components/PaymentOptionsModule/index.js +12 -114
- package/es/components/checkout/components/PaymentOptionsModule/index.less +23 -0
- package/es/components/checkout/components/PaymentResultToast/index.js +38 -8
- package/es/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
- package/es/components/checkout/components/SavePayLaterHandler/index.js +1 -1
- package/es/components/checkout/components/SearchAndClientModule/index.js +40 -39
- package/es/components/checkout/components/WalletPassModule/index.js +4 -3
- package/es/components/checkout/components/WalletPassModule/utils.js +10 -4
- package/es/components/checkout/hooks/useWalletPass.js +11 -4
- package/es/components/checkout/index.less +1 -1
- package/es/components/checkout/locales.d.ts +36 -0
- package/es/components/checkout/locales.js +43 -4
- package/es/components/checkout/types.d.ts +1 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +3 -3
- package/es/components/pay/toC/model.d.ts +1 -9
- package/es/components/schedules/model.d.ts +1 -9
- package/es/components/shoppingCart/components/Cart/Product.js +143 -71
- package/es/components/shoppingCart/components/Cart/index.js +1 -1
- package/es/components/shoppingCart/components/Cart/index.less +31 -0
- package/es/components/shoppingCart/locales.d.ts +3 -0
- package/es/components/shoppingCart/locales.js +12 -3
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +9 -12
- package/es/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
- package/es/components/ticketBooking/components/menuBar/index.js +3 -1
- package/es/components/ticketBooking/components/menuBar/index.less +7 -0
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
- package/es/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/utils/index.d.ts +1 -1
- package/es/components/ticketBooking/utils/index.js +2 -1
- package/es/components/wallet/Detail/model.d.ts +1 -13
- package/es/components/wallet/DiscountCard/model.d.ts +1 -14
- package/es/components/wallet/PointCard/model.d.ts +1 -13
- package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/es/components/wallet/Voucher/model.d.ts +1 -13
- package/es/components/wallet/model.d.ts +1 -9
- package/es/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +1 -1
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +148 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/index.js +1 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
- package/es/pro/pisellSimplePriceKeyboardPopover/types.js +1 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +331 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +349 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.js +49 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/locales.js +41 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
- package/es/pro/priceKeyboard/components/cashKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.js +465 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/locales.js +44 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
- package/es/pro/priceKeyboard/components/discountKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.js +444 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/locales.js +47 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
- package/es/pro/priceKeyboard/components/paymentKeyboard/types.js +1 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.js +47 -0
- package/es/pro/priceKeyboard/components/shortcuts/index.less +39 -0
- package/es/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
- package/es/pro/priceKeyboard/hooks/keyActions.js +252 -0
- package/es/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
- package/es/pro/priceKeyboard/hooks/rightItems.js +50 -0
- package/es/pro/priceKeyboard/index.d.ts +3 -0
- package/es/pro/priceKeyboard/index.js +3 -0
- package/es/pro/priceKeyboard/index.less +215 -0
- package/es/pro/priceKeyboard/utils.d.ts +31 -0
- package/es/pro/priceKeyboard/utils.js +51 -0
- package/es/pro/skuDetailModal/index.js +19 -16
- package/lib/components/booking/addons/model.d.ts +1 -10
- package/lib/components/booking/components/actionButtons/index.js +31 -28
- package/lib/components/booking/components/actionButtons/index.less +0 -28
- package/lib/components/booking/components/footer/amount.d.ts +3 -3
- package/lib/components/booking/components/footer/amount.js +49 -34
- package/lib/components/booking/components/footer/index.js +114 -40
- package/lib/components/booking/components/footer/utils.js +35 -7
- package/lib/components/booking/forms/model.d.ts +1 -10
- package/lib/components/booking/info/model.d.ts +1 -10
- package/lib/components/booking/info/model.js +3 -0
- package/lib/components/booking/info/service/addService/index.js +2 -1
- package/lib/components/booking/info/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/info2/index.js +18 -1
- package/lib/components/booking/info2/service/addService/index.js +2 -1
- package/lib/components/booking/info2/service/addService/utils.d.ts +1 -1
- package/lib/components/booking/info2/service/editService/index.js +12 -4
- package/lib/components/booking/model.d.ts +1 -9
- package/lib/components/booking/notes/model.d.ts +1 -10
- package/lib/components/booking/payments/model.d.ts +1 -10
- package/lib/components/booking/utils.js +10 -5
- package/lib/components/checkout/PaymentModal.d.ts +2 -0
- package/lib/components/checkout/PaymentModal.js +208 -91
- package/lib/components/checkout/components/AdditionalModule/index.less +1 -1
- package/lib/components/checkout/components/AmountSummary/index.js +120 -50
- package/lib/components/checkout/components/AmountSummary/index.less +13 -0
- package/lib/components/checkout/components/CashPaymentModule/index.d.ts +5 -3
- package/lib/components/checkout/components/CashPaymentModule/index.js +101 -134
- package/lib/components/checkout/components/CashPaymentModule/index.less +200 -176
- package/lib/components/checkout/components/PaymentDetailModal/index.js +2 -2
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.d.ts +29 -0
- package/lib/components/checkout/components/PaymentOptionsModule/PaymentMethodItem.js +163 -0
- package/lib/components/checkout/components/PaymentOptionsModule/index.d.ts +2 -4
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +11 -123
- package/lib/components/checkout/components/PaymentOptionsModule/index.less +23 -0
- package/lib/components/checkout/components/PaymentResultToast/index.js +26 -1
- package/lib/components/checkout/components/PaymentResultToast/types.d.ts +2 -0
- package/lib/components/checkout/components/SavePayLaterHandler/index.js +1 -1
- package/lib/components/checkout/components/SearchAndClientModule/index.js +3 -29
- package/lib/components/checkout/components/WalletPassModule/index.js +4 -3
- package/lib/components/checkout/components/WalletPassModule/utils.js +8 -4
- package/lib/components/checkout/hooks/useWalletPass.js +11 -6
- package/lib/components/checkout/index.less +1 -1
- package/lib/components/checkout/locales.d.ts +36 -0
- package/lib/components/checkout/locales.js +43 -4
- package/lib/components/checkout/types.d.ts +1 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +3 -3
- package/lib/components/pay/toC/model.d.ts +1 -9
- package/lib/components/schedules/model.d.ts +1 -9
- package/lib/components/shoppingCart/components/Cart/Product.js +111 -51
- package/lib/components/shoppingCart/components/Cart/index.js +1 -1
- package/lib/components/shoppingCart/components/Cart/index.less +31 -0
- package/lib/components/shoppingCart/locales.d.ts +3 -0
- package/lib/components/shoppingCart/locales.js +6 -3
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +0 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +1 -4
- package/lib/components/ticketBooking/components/addServiceVariant/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/menuBar/index.js +1 -1
- package/lib/components/ticketBooking/components/menuBar/index.less +7 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/hooks/pisellos/useCustomer.js +7 -7
- package/lib/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/utils/index.d.ts +1 -1
- package/lib/components/ticketBooking/utils/index.js +2 -1
- package/lib/components/wallet/Detail/model.d.ts +1 -13
- package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
- package/lib/components/wallet/PointCard/model.d.ts +1 -13
- package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
- package/lib/components/wallet/Voucher/model.d.ts +1 -13
- package/lib/components/wallet/model.d.ts +1 -9
- package/lib/pro/pisellPriceKeyboardPopover/PisellPriceKeyboardPopover.js +2 -2
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.d.ts +5 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.js +144 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/PisellPriceKeyboardPopover.less +23 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/index.d.ts +2 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/index.js +35 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/types.d.ts +33 -0
- package/lib/pro/pisellSimplePriceKeyboardPopover/types.js +17 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.d.ts +5 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardIntact.js +360 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.d.ts +13 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/CashKeyboardSimple.js +399 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.d.ts +12 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.js +76 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/index.less +103 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/locales.d.ts +39 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/locales.js +65 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/types.d.ts +97 -0
- package/lib/pro/priceKeyboard/components/cashKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.d.ts +22 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.js +504 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/index.less +47 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/locales.d.ts +42 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/locales.js +68 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/types.d.ts +17 -0
- package/lib/pro/priceKeyboard/components/discountKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.d.ts +12 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.js +488 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/index.less +64 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.d.ts +45 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/locales.js +71 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/types.d.ts +39 -0
- package/lib/pro/priceKeyboard/components/paymentKeyboard/types.js +17 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.d.ts +17 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.js +79 -0
- package/lib/pro/priceKeyboard/components/shortcuts/index.less +39 -0
- package/lib/pro/priceKeyboard/hooks/keyActions.d.ts +28 -0
- package/lib/pro/priceKeyboard/hooks/keyActions.js +176 -0
- package/lib/pro/priceKeyboard/hooks/rightItems.d.ts +28 -0
- package/lib/pro/priceKeyboard/hooks/rightItems.js +81 -0
- package/lib/pro/priceKeyboard/index.d.ts +3 -0
- package/lib/pro/priceKeyboard/index.js +45 -0
- package/lib/pro/priceKeyboard/index.less +215 -0
- package/lib/pro/priceKeyboard/utils.d.ts +31 -0
- package/lib/pro/priceKeyboard/utils.js +75 -0
- package/lib/pro/skuDetailModal/index.js +18 -22
- package/package.json +12 -12
@@ -0,0 +1,214 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
8
|
+
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."); }
|
9
|
+
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); }
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
11
|
+
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; } }
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
13
|
+
import React, { useState } from 'react';
|
14
|
+
import classnames from 'classnames';
|
15
|
+
import { formatAmount } from '@pisell/utils';
|
16
|
+
import { Iconfont } from '@pisell/materials';
|
17
|
+
import { Button } from 'antd';
|
18
|
+
import { PaymentKeyboard } from "../../../../pro/priceKeyboard";
|
19
|
+
import "./index.less";
|
20
|
+
|
21
|
+
// 扩展支付方法接口,添加手续费相关属性
|
22
|
+
|
23
|
+
var PaymentMethodItem = function PaymentMethodItem(_ref) {
|
24
|
+
var method = _ref.method,
|
25
|
+
amountSymbol = _ref.amountSymbol,
|
26
|
+
customAmount = _ref.customAmount,
|
27
|
+
_ref$disabled = _ref.disabled,
|
28
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
29
|
+
onClick = _ref.onClick,
|
30
|
+
getText = _ref.getText;
|
31
|
+
// 控制键盘弹窗显示状态
|
32
|
+
var _useState = useState(false),
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
34
|
+
isKeyboardVisible = _useState2[0],
|
35
|
+
setIsKeyboardVisible = _useState2[1];
|
36
|
+
// 计算Surcharge金额
|
37
|
+
var calculateSurcharge = function calculateSurcharge(method) {
|
38
|
+
if (!(method !== null && method !== void 0 && method.is_surcharge)) return 0;
|
39
|
+
var baseAmount = Number(customAmount) || 0;
|
40
|
+
if (Number(method.percentage)) {
|
41
|
+
return baseAmount * Number(method.percentage) + Number(method.fixed || 0);
|
42
|
+
}
|
43
|
+
return Number(method.fixed || 0);
|
44
|
+
};
|
45
|
+
|
46
|
+
// 计算总金额(包含Surcharge)
|
47
|
+
var calculateTotalAmount = function calculateTotalAmount(method) {
|
48
|
+
var baseAmount = Number(customAmount) || 0;
|
49
|
+
var surcharge = calculateSurcharge(method);
|
50
|
+
return baseAmount + surcharge;
|
51
|
+
};
|
52
|
+
|
53
|
+
// 处理右侧按钮点击事件
|
54
|
+
var handleRightButtonClick = function handleRightButtonClick(e) {
|
55
|
+
if (!isEftpos) return;
|
56
|
+
e.preventDefault();
|
57
|
+
// e.stopPropagation(); // 防止事件冒泡到外层按钮
|
58
|
+
if (disabled || !onClick) {
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
onClick(_objectSpread(_objectSpread({}, method), {}, {
|
62
|
+
surcharge: String(formatAmount(calculateSurcharge(method), 2, amountSymbol))
|
63
|
+
}));
|
64
|
+
};
|
65
|
+
|
66
|
+
// 渲染支付图标
|
67
|
+
var renderPaymentIcon = function renderPaymentIcon(method) {
|
68
|
+
if (method.code === 'EFTPOS') {
|
69
|
+
return /*#__PURE__*/React.createElement("div", {
|
70
|
+
className: classnames('payment-options-module-icon-container'),
|
71
|
+
style: {
|
72
|
+
background: '#FE8279'
|
73
|
+
}
|
74
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
75
|
+
type: "pisell2-credit",
|
76
|
+
style: {
|
77
|
+
fontSize: '26px',
|
78
|
+
color: '#ffffff'
|
79
|
+
}
|
80
|
+
}));
|
81
|
+
}
|
82
|
+
switch (String(method.type)) {
|
83
|
+
case 'credit-card':
|
84
|
+
case 'eftpos':
|
85
|
+
return /*#__PURE__*/React.createElement("div", {
|
86
|
+
className: classnames('payment-options-module-icon-container'),
|
87
|
+
style: {
|
88
|
+
background: '#FE8279'
|
89
|
+
}
|
90
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
91
|
+
type: "pisell2-credit",
|
92
|
+
style: {
|
93
|
+
fontSize: '26px',
|
94
|
+
color: '#ffffff'
|
95
|
+
}
|
96
|
+
}));
|
97
|
+
default:
|
98
|
+
return /*#__PURE__*/React.createElement("div", {
|
99
|
+
className: classnames('payment-options-module-icon-container'),
|
100
|
+
style: {
|
101
|
+
background: '#D277E4'
|
102
|
+
}
|
103
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
104
|
+
type: "pisell2-custom",
|
105
|
+
style: {
|
106
|
+
fontSize: '26px',
|
107
|
+
color: '#ffffff'
|
108
|
+
}
|
109
|
+
}));
|
110
|
+
}
|
111
|
+
};
|
112
|
+
|
113
|
+
// 判断是否为EFTPOS支付方式
|
114
|
+
var isEftpos = method.code === 'EFTPOS' || method.type === 'eftpos';
|
115
|
+
var showKeyboard = function showKeyboard() {
|
116
|
+
if (isEftpos) return;
|
117
|
+
setIsKeyboardVisible(true);
|
118
|
+
};
|
119
|
+
|
120
|
+
// 渲染左侧内容
|
121
|
+
var renderLeftContent = function renderLeftContent() {
|
122
|
+
return /*#__PURE__*/React.createElement("div", {
|
123
|
+
className: classnames('payment-options-module-payment-method-left')
|
124
|
+
}, /*#__PURE__*/React.createElement("div", {
|
125
|
+
className: classnames('payment-options-module-icon-container')
|
126
|
+
}, renderPaymentIcon(method)), /*#__PURE__*/React.createElement("div", {
|
127
|
+
className: classnames('payment-options-module-payment-info')
|
128
|
+
}, /*#__PURE__*/React.createElement("div", {
|
129
|
+
className: classnames('payment-options-module-payment-info-inner')
|
130
|
+
}, /*#__PURE__*/React.createElement("div", {
|
131
|
+
className: classnames('payment-options-module-payment-name')
|
132
|
+
}, method.name), /*#__PURE__*/React.createElement("div", {
|
133
|
+
className: classnames('payment-options-module-payment-info-inner-surcharge')
|
134
|
+
}, !!(method !== null && method !== void 0 && method.is_surcharge) && calculateSurcharge(method) !== 0 && /*#__PURE__*/React.createElement("div", {
|
135
|
+
className: classnames('payment-options-module-surcharge-text')
|
136
|
+
}, (getText === null || getText === void 0 ? void 0 : getText('pisell2.payment-options.surcharge-label', 'Surcharge')) || 'Surcharge', ":", formatAmount(calculateSurcharge(method), 2, amountSymbol)), false && /*#__PURE__*/React.createElement("div", {
|
137
|
+
className: classnames('payment-options-module-surcharge-text'),
|
138
|
+
style: {
|
139
|
+
cursor: 'pointer'
|
140
|
+
}
|
141
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
142
|
+
type: "pisell2-edit-05",
|
143
|
+
style: {
|
144
|
+
fontSize: '24px',
|
145
|
+
color: disabled ? '#D0D5DD' : '#7F56DA'
|
146
|
+
}
|
147
|
+
}))))));
|
148
|
+
};
|
149
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
150
|
+
className: classnames('payment-options-module-payment-method-item', {
|
151
|
+
'payment-options-module-pointer': !disabled,
|
152
|
+
'payment-options-module-disabled': disabled
|
153
|
+
}),
|
154
|
+
onClick: showKeyboard,
|
155
|
+
type: "button",
|
156
|
+
disabled: disabled
|
157
|
+
}, renderLeftContent(), /*#__PURE__*/React.createElement("div", {
|
158
|
+
className: classnames('payment-options-module-payment-method-right'),
|
159
|
+
onClick: handleRightButtonClick
|
160
|
+
},
|
161
|
+
// 右侧按钮,如果是eftpos,则显示Pay按钮
|
162
|
+
isEftpos ? /*#__PURE__*/React.createElement(Button, {
|
163
|
+
type: "primary",
|
164
|
+
className: classnames('payment-options-module-pay-button'),
|
165
|
+
disabled: disabled
|
166
|
+
}, getText === null || getText === void 0 ? void 0 : getText('pay', 'Pay')) : /*#__PURE__*/React.createElement("div", {
|
167
|
+
className: classnames('payment-options-module-selection-button')
|
168
|
+
}, /*#__PURE__*/React.createElement(Iconfont, {
|
169
|
+
type: "pisell2-a-arrow-circle-right2",
|
170
|
+
style: {
|
171
|
+
fontSize: '30px',
|
172
|
+
color: disabled ? '#D0D5DD' : '#7F56DA'
|
173
|
+
}
|
174
|
+
})))), /*#__PURE__*/React.createElement(PaymentKeyboard, {
|
175
|
+
containerProps: {
|
176
|
+
renderType: 'modal',
|
177
|
+
open: isKeyboardVisible,
|
178
|
+
onCancel: function onCancel() {
|
179
|
+
return setIsKeyboardVisible(false);
|
180
|
+
}
|
181
|
+
},
|
182
|
+
paymentOriginalValue: String(customAmount || 0),
|
183
|
+
paymentDefaultValue: String(customAmount || 0),
|
184
|
+
enableExceedMaxAmount: !isEftpos,
|
185
|
+
payment: {
|
186
|
+
enable: true
|
187
|
+
},
|
188
|
+
surcharge: {
|
189
|
+
enable: !!(method !== null && method !== void 0 && method.is_surcharge) && calculateSurcharge(method) !== 0
|
190
|
+
},
|
191
|
+
surchargeDefaultValue: {
|
192
|
+
percent: method.percentage ? String(Number(method.percentage) * 100) : '',
|
193
|
+
fixed: method.fixed ? String(method.fixed) : ''
|
194
|
+
},
|
195
|
+
selectType: "dark",
|
196
|
+
onChange: function onChange(value) {
|
197
|
+
console.log(value);
|
198
|
+
},
|
199
|
+
onPay: function onPay(args) {
|
200
|
+
console.log(args);
|
201
|
+
// 处理支付逻辑
|
202
|
+
setIsKeyboardVisible(false);
|
203
|
+
if (onClick) {
|
204
|
+
var _args$surcharge, _args$surcharge2;
|
205
|
+
onClick(_objectSpread(_objectSpread({}, method), {}, {
|
206
|
+
fixed: Number(((_args$surcharge = args.surcharge) === null || _args$surcharge === void 0 ? void 0 : _args$surcharge.fixed) || 0),
|
207
|
+
percentage: (_args$surcharge2 = args.surcharge) !== null && _args$surcharge2 !== void 0 && _args$surcharge2.percent ? Number(args.surcharge.percent) / 100 : 0,
|
208
|
+
totalAmount: String(formatAmount(args.amount, 2))
|
209
|
+
}));
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}));
|
213
|
+
};
|
214
|
+
export default PaymentMethodItem;
|
@@ -1,9 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
import {
|
2
|
+
import { ExtendedPaymentMethod } from './PaymentMethodItem';
|
3
|
+
import { PaymentOptionsModuleProps } from '../../types';
|
3
4
|
import './index.less';
|
4
|
-
interface ExtendedPaymentMethod extends PaymentMethod {
|
5
|
-
is_surcharge?: boolean;
|
6
|
-
}
|
7
5
|
interface ExtendedPaymentOptionsModuleProps extends PaymentOptionsModuleProps {
|
8
6
|
amountSymbol?: string;
|
9
7
|
paymentMethods?: ExtendedPaymentMethod[];
|
@@ -1,21 +1,13 @@
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
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
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
1
|
import ScrollableList from "../ScrollableList/index";
|
2
|
+
import PaymentMethodItem from "./PaymentMethodItem";
|
8
3
|
import React from 'react';
|
9
4
|
import classnames from 'classnames';
|
10
5
|
import "./index.less";
|
11
|
-
import {
|
12
|
-
import { Iconfont } from '@pisell/materials';
|
6
|
+
import { locales } from '@pisell/utils';
|
13
7
|
import { useDebounceFn } from 'ahooks';
|
14
8
|
import useEngineContext from "../../../../hooks/useEngineContext";
|
15
9
|
import checkoutLocales from "../../locales";
|
16
10
|
|
17
|
-
// 扩展支付方法接口,添加手续费相关属性
|
18
|
-
|
19
11
|
// 扩展 PaymentOptionsModule Props 接口
|
20
12
|
|
21
13
|
var SHOW_METHODS_CODE = ['EFTPOS_LINKLY', 'EFTPOS', 'EFTPOS_TYRO', 'EFTPOS_WINDCAVE', 'EFTPOS_PAYO'];
|
@@ -56,82 +48,18 @@ function PaymentOptionsModule(_ref) {
|
|
56
48
|
return !(item.type === 'app' && item.code === 'EFTPOS_LINKLY') && (['custom'].includes(item.type) || SHOW_METHODS_CODE.includes(item.code));
|
57
49
|
});
|
58
50
|
|
59
|
-
// 计算Surcharge金额
|
60
|
-
var calculateSurcharge = function calculateSurcharge(method) {
|
61
|
-
if (!(method !== null && method !== void 0 && method.is_surcharge)) return 0;
|
62
|
-
var baseAmount = Number(customAmount) || 0;
|
63
|
-
if (Number(method.percentage)) {
|
64
|
-
return baseAmount * Number(method.percentage) + Number(method.fixed || 0);
|
65
|
-
}
|
66
|
-
return Number(method.fixed || 0);
|
67
|
-
};
|
68
|
-
|
69
|
-
// 计算总金额(包含Surcharge)
|
70
|
-
var calculateTotalAmount = function calculateTotalAmount(method) {
|
71
|
-
var baseAmount = Number(customAmount) || 0;
|
72
|
-
var surcharge = calculateSurcharge(method);
|
73
|
-
return baseAmount + surcharge;
|
74
|
-
};
|
75
|
-
|
76
51
|
// 防抖处理支付方式点击
|
77
52
|
var _useDebounceFn = useDebounceFn(function (method) {
|
78
53
|
if (disabled) {
|
79
54
|
return;
|
80
55
|
}
|
81
56
|
if (typeof onClick === 'function') {
|
82
|
-
onClick(
|
83
|
-
surcharge: String(formatAmount(calculateSurcharge(method), 2, amountSymbol))
|
84
|
-
}));
|
57
|
+
onClick(method);
|
85
58
|
}
|
86
59
|
}, {
|
87
60
|
wait: 500 // 500ms 防抖延迟
|
88
61
|
}),
|
89
62
|
handlePaymentClick = _useDebounceFn.run;
|
90
|
-
var renderPaymentIcon = function renderPaymentIcon(method) {
|
91
|
-
if (method.code === 'EFTPOS') {
|
92
|
-
return /*#__PURE__*/React.createElement("div", {
|
93
|
-
className: classnames('payment-options-module-icon-container'),
|
94
|
-
style: {
|
95
|
-
background: '#FE8279'
|
96
|
-
}
|
97
|
-
}, /*#__PURE__*/React.createElement(Iconfont, {
|
98
|
-
type: "pisell2-credit",
|
99
|
-
style: {
|
100
|
-
fontSize: '26px',
|
101
|
-
color: '#ffffff'
|
102
|
-
}
|
103
|
-
}));
|
104
|
-
}
|
105
|
-
switch (String(method.type)) {
|
106
|
-
case 'credit-card':
|
107
|
-
case 'eftpos':
|
108
|
-
return /*#__PURE__*/React.createElement("div", {
|
109
|
-
className: classnames('payment-options-module-icon-container'),
|
110
|
-
style: {
|
111
|
-
background: '#FE8279'
|
112
|
-
}
|
113
|
-
}, /*#__PURE__*/React.createElement(Iconfont, {
|
114
|
-
type: "pisell2-credit",
|
115
|
-
style: {
|
116
|
-
fontSize: '26px',
|
117
|
-
color: '#ffffff'
|
118
|
-
}
|
119
|
-
}));
|
120
|
-
default:
|
121
|
-
return /*#__PURE__*/React.createElement("div", {
|
122
|
-
className: classnames('payment-options-module-icon-container'),
|
123
|
-
style: {
|
124
|
-
background: '#D277E4'
|
125
|
-
}
|
126
|
-
}, /*#__PURE__*/React.createElement(Iconfont, {
|
127
|
-
type: "pisell2-custom",
|
128
|
-
style: {
|
129
|
-
fontSize: '26px',
|
130
|
-
color: '#ffffff'
|
131
|
-
}
|
132
|
-
}));
|
133
|
-
}
|
134
|
-
};
|
135
63
|
return /*#__PURE__*/React.createElement("div", {
|
136
64
|
className: classnames('payment-options-module', {
|
137
65
|
'payment-options-module-disabled': disabled
|
@@ -143,7 +71,7 @@ function PaymentOptionsModule(_ref) {
|
|
143
71
|
}, /*#__PURE__*/React.createElement(ScrollableList, {
|
144
72
|
height: "100%" // 占满剩余空间
|
145
73
|
,
|
146
|
-
maxHeight:
|
74
|
+
maxHeight: 314,
|
147
75
|
gradientColor: "rgba(139, 92, 246, 0.1)",
|
148
76
|
gradientHeight: 50,
|
149
77
|
columnCount: showCashPayment ? 1 : 2,
|
@@ -160,45 +88,15 @@ function PaymentOptionsModule(_ref) {
|
|
160
88
|
paddingBottom: 8
|
161
89
|
}
|
162
90
|
}, filteredPaymentMethods.map(function (method) {
|
163
|
-
return /*#__PURE__*/React.createElement(
|
91
|
+
return /*#__PURE__*/React.createElement(PaymentMethodItem, {
|
164
92
|
key: method.id,
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
}),
|
173
|
-
type: "button",
|
174
|
-
disabled: disabled
|
175
|
-
}, /*#__PURE__*/React.createElement("div", {
|
176
|
-
className: classnames('payment-options-module-payment-method-left')
|
177
|
-
}, /*#__PURE__*/React.createElement("div", {
|
178
|
-
className: classnames('payment-options-module-icon-container')
|
179
|
-
}, renderPaymentIcon(method)), /*#__PURE__*/React.createElement("div", {
|
180
|
-
className: classnames('payment-options-module-payment-info')
|
181
|
-
}, /*#__PURE__*/React.createElement("div", {
|
182
|
-
className: classnames('payment-options-module-payment-info-inner')
|
183
|
-
}, /*#__PURE__*/React.createElement("div", {
|
184
|
-
className: classnames('payment-options-module-payment-name')
|
185
|
-
}, method.name), !!(method !== null && method !== void 0 && method.is_surcharge) && calculateSurcharge(method) !== 0 && /*#__PURE__*/React.createElement("div", {
|
186
|
-
className: classnames('payment-options-module-surcharge-text')
|
187
|
-
}, getText('pisell2.payment-options.surcharge-label', 'Surcharge'), ":", formatAmount(calculateSurcharge(method), 2, amountSymbol))))), /*#__PURE__*/React.createElement("div", {
|
188
|
-
className: classnames('payment-options-module-payment-method-right')
|
189
|
-
}, method.code !== 'EFTPOS' && method.type !== 'eftpos' && /*#__PURE__*/React.createElement("div", {
|
190
|
-
className: classnames('payment-options-module-amount', 'payment-options-module-theme-color')
|
191
|
-
}, formatAmount(calculateTotalAmount(method), 2, amountSymbol)), /*#__PURE__*/React.createElement("div", {
|
192
|
-
className: classnames('payment-options-module-selection-button', {
|
193
|
-
'payment-options-module-selection-button-disabled': disabled
|
194
|
-
})
|
195
|
-
}, /*#__PURE__*/React.createElement(Iconfont, {
|
196
|
-
type: "pisell2-a-arrow-circle-right2",
|
197
|
-
style: {
|
198
|
-
fontSize: '30px',
|
199
|
-
color: '#7F56DA'
|
200
|
-
}
|
201
|
-
}))));
|
93
|
+
method: method,
|
94
|
+
amountSymbol: amountSymbol,
|
95
|
+
customAmount: customAmount,
|
96
|
+
disabled: disabled,
|
97
|
+
onClick: handlePaymentClick,
|
98
|
+
getText: getText
|
99
|
+
});
|
202
100
|
}))));
|
203
101
|
}
|
204
102
|
export default PaymentOptionsModule;
|
@@ -44,6 +44,7 @@
|
|
44
44
|
align-items: center;
|
45
45
|
display: flex;
|
46
46
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
47
|
+
gap: 12px;
|
47
48
|
}
|
48
49
|
|
49
50
|
|
@@ -94,6 +95,14 @@
|
|
94
95
|
align-items: center;
|
95
96
|
gap: 8px;
|
96
97
|
display: flex;
|
98
|
+
flex: 1;
|
99
|
+
background: none;
|
100
|
+
border: none;
|
101
|
+
cursor: pointer;
|
102
|
+
padding: 0;
|
103
|
+
margin: 0;
|
104
|
+
outline: none;
|
105
|
+
box-shadow: none;
|
97
106
|
}
|
98
107
|
|
99
108
|
|
@@ -224,6 +233,20 @@
|
|
224
233
|
cursor: pointer;
|
225
234
|
}
|
226
235
|
|
236
|
+
.payment-options-module-pay-button{
|
237
|
+
background: var(--theme-color, #7F56DA);
|
238
|
+
&:disabled {
|
239
|
+
background: #D0D5DD;
|
240
|
+
color: #fff;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
.payment-options-module-payment-info-inner-surcharge{
|
245
|
+
display: flex;
|
246
|
+
align-items: center;
|
247
|
+
gap: 8px;
|
248
|
+
}
|
249
|
+
|
227
250
|
/* Disabled state styles */
|
228
251
|
.payment-options-module-disabled {
|
229
252
|
cursor: unset !important;
|
@@ -61,7 +61,9 @@ var PaymentResultToast = /*#__PURE__*/memo(function (props) {
|
|
61
61
|
maskClosable = _props$maskClosable === void 0 ? false : _props$maskClosable,
|
62
62
|
_props$closable = props.closable,
|
63
63
|
closable = _props$closable === void 0 ? true : _props$closable,
|
64
|
-
zIndex = props.zIndex
|
64
|
+
zIndex = props.zIndex,
|
65
|
+
_props$clickOutsideTo = props.clickOutsideToClose,
|
66
|
+
clickOutsideToClose = _props$clickOutsideTo === void 0 ? true : _props$clickOutsideTo;
|
65
67
|
|
66
68
|
// 倒计时相关状态
|
67
69
|
var _useState = useState(false),
|
@@ -70,6 +72,11 @@ var PaymentResultToast = /*#__PURE__*/memo(function (props) {
|
|
70
72
|
setIsAnimating = _useState2[1];
|
71
73
|
var countdownTimeoutRef = useRef(null);
|
72
74
|
|
75
|
+
// 弹窗内容引用,用于 click outside 检测
|
76
|
+
var modalContentRef = useRef(null);
|
77
|
+
// Modal 根容器引用
|
78
|
+
var modalRef = useRef(null);
|
79
|
+
|
73
80
|
// 使用ref保存回调函数,避免依赖变化导致倒计时重置
|
74
81
|
var onCloseRef = useRef(onClose);
|
75
82
|
var onCountdownCompleteRef = useRef(onCountdownComplete);
|
@@ -130,18 +137,40 @@ var PaymentResultToast = /*#__PURE__*/memo(function (props) {
|
|
130
137
|
return clearCountdown;
|
131
138
|
}, [clearCountdown]);
|
132
139
|
|
140
|
+
// Click outside 检测
|
141
|
+
useEffect(function () {
|
142
|
+
if (!clickOutsideToClose || !visible) {
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
var handleClickOutside = function handleClickOutside(event) {
|
146
|
+
var target = event.target;
|
147
|
+
var modalContent = modalContentRef.current;
|
148
|
+
if (!modalContent) {
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
|
152
|
+
// 检查点击的目标元素是否在弹窗内容之外
|
153
|
+
if (!modalContent.contains(target)) {
|
154
|
+
var _onCloseRef$current2;
|
155
|
+
// 点击在弹窗外部,关闭弹窗
|
156
|
+
clearCountdown(); // 取消倒计时
|
157
|
+
(_onCloseRef$current2 = onCloseRef.current) === null || _onCloseRef$current2 === void 0 || _onCloseRef$current2.call(onCloseRef);
|
158
|
+
}
|
159
|
+
};
|
160
|
+
document.addEventListener('mousedown', handleClickOutside);
|
161
|
+
// 清理函数
|
162
|
+
return function () {
|
163
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
164
|
+
};
|
165
|
+
}, [clickOutsideToClose, visible, clearCountdown]);
|
166
|
+
|
133
167
|
// 处理关闭操作(关闭按钮点击时也取消倒计时)
|
134
168
|
var handleClose = useCallback(function () {
|
135
|
-
var _onCloseRef$
|
169
|
+
var _onCloseRef$current3;
|
136
170
|
clearCountdown(); // 取消倒计时
|
137
|
-
(_onCloseRef$
|
171
|
+
(_onCloseRef$current3 = onCloseRef.current) === null || _onCloseRef$current3 === void 0 || _onCloseRef$current3.call(onCloseRef);
|
138
172
|
}, [clearCountdown]);
|
139
173
|
|
140
|
-
// 注释掉点击处理,现在完全由CSS的pointer-events控制穿透
|
141
|
-
// const handleContentClick: React.MouseEventHandler<HTMLDivElement> = useCallback((e) => {
|
142
|
-
// // 由CSS的pointer-events控制点击穿透,不需要JavaScript处理
|
143
|
-
// }, []);
|
144
|
-
|
145
174
|
// 渲染标题(合并原副标题内容)
|
146
175
|
var renderTitle = function renderTitle() {
|
147
176
|
if (!subtitle) {
|
@@ -275,6 +304,7 @@ var PaymentResultToast = /*#__PURE__*/memo(function (props) {
|
|
275
304
|
,
|
276
305
|
getContainer: false
|
277
306
|
}, /*#__PURE__*/React.createElement("div", {
|
307
|
+
ref: modalContentRef,
|
278
308
|
className: getClassName('content', statusClassName),
|
279
309
|
style: {
|
280
310
|
position: 'relative',
|
@@ -89,7 +89,7 @@ var SavePayLaterHandler = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
89
89
|
mask: true,
|
90
90
|
maskClosable: false,
|
91
91
|
centered: true,
|
92
|
-
width:
|
92
|
+
width: 530,
|
93
93
|
title: getText('pisell2.checkout.wallet-balance-confirm.title'),
|
94
94
|
footer: null,
|
95
95
|
className: "wallet-balance-confirm-modal",
|
@@ -40,12 +40,12 @@ var SearchAndClientModule = function SearchAndClientModule(props) {
|
|
40
40
|
var bookingTicket = useBookingTicket();
|
41
41
|
var handleSearch = useDebounceFn( /*#__PURE__*/function () {
|
42
42
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyword) {
|
43
|
-
var res, _Toast$info, _clientCardRef$curren, _clientCardRef$curren2,
|
43
|
+
var res, _Toast$info, _clientCardRef$curren, _clientCardRef$curren2, _res$data, customer, rest, _Toast$info2, _customer;
|
44
44
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
45
45
|
while (1) switch (_context.prev = _context.next) {
|
46
46
|
case 0:
|
47
47
|
if (!keyword) {
|
48
|
-
_context.next =
|
48
|
+
_context.next = 24;
|
49
49
|
break;
|
50
50
|
}
|
51
51
|
setLoading(true);
|
@@ -62,46 +62,47 @@ var SearchAndClientModule = function SearchAndClientModule(props) {
|
|
62
62
|
return _context.abrupt("return");
|
63
63
|
case 9:
|
64
64
|
if (!('type' in res && res.type == 'walletCode')) {
|
65
|
-
_context.next =
|
65
|
+
_context.next = 16;
|
66
66
|
break;
|
67
67
|
}
|
68
|
-
if (
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
68
|
+
// if (disabledSwitch) {
|
69
|
+
// Toast?.info?.(
|
70
|
+
// locales.getText(
|
71
|
+
// 'pisell2.checkout.client-card.tip.partially-paid'
|
72
|
+
// )
|
73
|
+
// );
|
74
|
+
// return;
|
75
|
+
// }
|
75
76
|
_res$data = res.data, customer = _res$data.customer, rest = _objectWithoutProperties(_res$data, _excluded); // todo 无绑定client
|
76
77
|
if (customer) {
|
77
|
-
_context.next =
|
78
|
+
_context.next = 14;
|
78
79
|
break;
|
79
80
|
}
|
80
|
-
Toast === null || Toast === void 0 || (_Toast$
|
81
|
+
Toast === null || Toast === void 0 || (_Toast$info2 = Toast.info) === null || _Toast$info2 === void 0 || _Toast$info2.call(Toast, locales.getText('pisell2.checkout.wallet-pass-module.no-result'));
|
81
82
|
return _context.abrupt("return");
|
82
|
-
case
|
83
|
+
case 14:
|
83
84
|
_customer = _objectSpread(_objectSpread({}, customer), {}, {
|
84
85
|
latest_wallet_detail: rest
|
85
86
|
}); // @ts-ignore
|
86
87
|
(_clientCardRef$curren = clientCardRef.current) === null || _clientCardRef$curren === void 0 || (_clientCardRef$curren2 = _clientCardRef$curren.handleSetClient) === null || _clientCardRef$curren2 === void 0 || _clientCardRef$curren2.call(_clientCardRef$curren, _customer, {
|
87
88
|
sameClientTip: locales.getText('pisell2.checkout.client-card.tip.same-client')
|
88
89
|
});
|
89
|
-
case
|
90
|
+
case 16:
|
90
91
|
setValue('');
|
91
|
-
_context.next =
|
92
|
+
_context.next = 21;
|
92
93
|
break;
|
93
|
-
case
|
94
|
-
_context.prev =
|
94
|
+
case 19:
|
95
|
+
_context.prev = 19;
|
95
96
|
_context.t0 = _context["catch"](2);
|
96
|
-
case
|
97
|
-
_context.prev =
|
97
|
+
case 21:
|
98
|
+
_context.prev = 21;
|
98
99
|
setLoading(false);
|
99
|
-
return _context.finish(
|
100
|
-
case
|
100
|
+
return _context.finish(21);
|
101
|
+
case 24:
|
101
102
|
case "end":
|
102
103
|
return _context.stop();
|
103
104
|
}
|
104
|
-
}, _callee, null, [[2,
|
105
|
+
}, _callee, null, [[2, 19, 21, 24]]);
|
105
106
|
}));
|
106
107
|
return function (_x) {
|
107
108
|
return _ref.apply(this, arguments);
|
@@ -150,23 +151,23 @@ var SearchAndClientModule = function SearchAndClientModule(props) {
|
|
150
151
|
size: 'default'
|
151
152
|
}
|
152
153
|
};
|
153
|
-
if (disabledSwitch === true) {
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
154
|
+
// if (disabledSwitch === true) {
|
155
|
+
// _props = {
|
156
|
+
// open: false,
|
157
|
+
// buttonProps: {
|
158
|
+
// icon,
|
159
|
+
// size: 'default',
|
160
|
+
// onClick: () => {
|
161
|
+
// // todo 根据当前订单付款情况判断是否可以切换
|
162
|
+
// Toast?.info?.(
|
163
|
+
// locales.getText('pisell2.checkout.client-card.tip.partially-paid')
|
164
|
+
// );
|
165
|
+
// },
|
166
|
+
// style: { cursor: 'not-allowed' },
|
167
|
+
// },
|
168
|
+
// };
|
169
|
+
// }
|
170
|
+
|
170
171
|
return _props;
|
171
172
|
}, [Toast, disabledSwitch]);
|
172
173
|
return /*#__PURE__*/React.createElement("div", {
|