@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
@@ -16,13 +16,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
16
16
|
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; } }
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
18
18
|
import React, { useRef, useState, useEffect, useCallback, useMemo, useImperativeHandle, forwardRef } from 'react';
|
19
|
+
import Decimal from 'decimal.js';
|
19
20
|
import { locales } from '@pisell/utils';
|
20
21
|
import { getLocale } from "../../utils/locales";
|
21
22
|
import { useMemoizedFn } from 'ahooks';
|
22
23
|
import { createPortal } from 'react-dom';
|
23
24
|
import ReactDOM from 'react-dom';
|
24
25
|
import checkoutLocales from "./locales";
|
25
|
-
import { PisellContainer,
|
26
|
+
import { PisellContainer, Icon, useToast, ConfigProvider } from '@pisell/materials';
|
26
27
|
import useEngineContext from "../../hooks/useEngineContext";
|
27
28
|
import NoteModal from "../../plus/noteModal";
|
28
29
|
import SendPaymentLinkModal from "./components/SendPaymentLinkModal";
|
@@ -46,6 +47,7 @@ import { getShopWalletPassId, reorderPaymentMethodList } from "./utils";
|
|
46
47
|
import usePaymentLogger from "./hooks/usePaymentLogger";
|
47
48
|
import { Button } from 'antd';
|
48
49
|
import usePrinter from "../../hooks/printer";
|
50
|
+
import { DiscountKeyboard } from "../../pro/priceKeyboard";
|
49
51
|
|
50
52
|
// Checkout 模块的事件常量
|
51
53
|
var CheckoutHooks = {
|
@@ -87,7 +89,9 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
87
89
|
dynamicMaxHeight = _ref$dynamicMaxHeight === void 0 ? '600px' : _ref$dynamicMaxHeight,
|
88
90
|
onOrderSyncFailed = _ref.onOrderSyncFailed,
|
89
91
|
generateActionButtons = _ref.generateActionButtons,
|
90
|
-
paymentResultToastConfig = _ref.paymentResultToastConfig
|
92
|
+
paymentResultToastConfig = _ref.paymentResultToastConfig,
|
93
|
+
updateOrderInfo = _ref.updateOrderInfo,
|
94
|
+
setCurrentEditOrderId = _ref.setCurrentEditOrderId;
|
91
95
|
var context = useEngineContext();
|
92
96
|
var utils = context.appHelper.utils || {};
|
93
97
|
var pisellos = utils.pisellos,
|
@@ -140,6 +144,10 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
140
144
|
setWalletPassData = _useState16[1];
|
141
145
|
var _usePrinter = usePrinter(),
|
142
146
|
nativePrint = _usePrinter.nativePrint;
|
147
|
+
var _useState17 = useState(false),
|
148
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
149
|
+
syncingLock = _useState18[0],
|
150
|
+
setSyncingLock = _useState18[1];
|
143
151
|
var isOrderFree = useMemo(function () {
|
144
152
|
if (!customAmount) return false;
|
145
153
|
var amount = parseFloat(customAmount);
|
@@ -147,14 +155,14 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
147
155
|
}, [customAmount]);
|
148
156
|
|
149
157
|
// 新增状态:订单备注和手动折扣
|
150
|
-
var _useState17 = useState(false),
|
151
|
-
_useState18 = _slicedToArray(_useState17, 2),
|
152
|
-
paymentLinkModalOpen = _useState18[0],
|
153
|
-
setPaymentLinkModalOpen = _useState18[1];
|
154
158
|
var _useState19 = useState(false),
|
155
159
|
_useState20 = _slicedToArray(_useState19, 2),
|
156
|
-
|
157
|
-
|
160
|
+
paymentLinkModalOpen = _useState20[0],
|
161
|
+
setPaymentLinkModalOpen = _useState20[1];
|
162
|
+
var _useState21 = useState(false),
|
163
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
164
|
+
showPriceAdjustModal = _useState22[0],
|
165
|
+
setShowPriceAdjustModal = _useState22[1];
|
158
166
|
var logger = usePaymentLogger();
|
159
167
|
var currency = getData('shop_currency_code') || 'USD';
|
160
168
|
|
@@ -189,7 +197,19 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
189
197
|
var _method$name;
|
190
198
|
return method.code === 'CASHMANUAL' || method.type === 'CASHMANUAL' || ((_method$name = method.name) === null || _method$name === void 0 ? void 0 : _method$name.toLowerCase().includes('cash'));
|
191
199
|
});
|
192
|
-
|
200
|
+
logger === null || logger === void 0 || logger.addLog({
|
201
|
+
type: 'info',
|
202
|
+
title: 'open_till',
|
203
|
+
metadata: {}
|
204
|
+
});
|
205
|
+
interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
|
206
|
+
module: 'till',
|
207
|
+
key: 'open_till',
|
208
|
+
data: {
|
209
|
+
type: 'cash' // cash 不需要验证钱箱权限
|
210
|
+
}
|
211
|
+
});
|
212
|
+
_context.next = 5;
|
193
213
|
return checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.addPaymentItemAsync({
|
194
214
|
amount: result.amount,
|
195
215
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
@@ -204,19 +224,6 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
204
224
|
voucher_id: 0,
|
205
225
|
rounding_amount: result.roundingAmount
|
206
226
|
});
|
207
|
-
case 3:
|
208
|
-
logger === null || logger === void 0 || logger.addLog({
|
209
|
-
type: 'info',
|
210
|
-
title: 'open_till',
|
211
|
-
metadata: {}
|
212
|
-
});
|
213
|
-
interaction === null || interaction === void 0 || (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 || (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 || _interaction$utils$po.call(_interaction$utils, {
|
214
|
-
module: 'till',
|
215
|
-
key: 'open_till',
|
216
|
-
data: {
|
217
|
-
type: 'cash' // cash 不需要验证钱箱权限
|
218
|
-
}
|
219
|
-
});
|
220
227
|
case 5:
|
221
228
|
case "end":
|
222
229
|
return _context.stop();
|
@@ -228,11 +235,12 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
228
235
|
};
|
229
236
|
}();
|
230
237
|
|
231
|
-
// 处理 surcharge
|
238
|
+
// 处理 surcharge 字符串,提取其中的金额数字(包括小数点)
|
232
239
|
var processSurcharge = function processSurcharge(surcharge) {
|
233
240
|
if (typeof surcharge === 'string') {
|
234
|
-
//
|
235
|
-
|
241
|
+
// 使用正则表达式提取字符串中的数字(包括小数点)
|
242
|
+
var match = surcharge.match(/\d+(?:\.\d+)?/);
|
243
|
+
return match ? match[0] : undefined;
|
236
244
|
}
|
237
245
|
if (typeof surcharge === 'number') {
|
238
246
|
// 如果是数字,转换为字符串
|
@@ -242,11 +250,13 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
242
250
|
};
|
243
251
|
var onPaymentOptionClick = /*#__PURE__*/function () {
|
244
252
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(method) {
|
245
|
-
var
|
253
|
+
var _method$totalAmount;
|
254
|
+
var _ref4, id, code, name, type, finalAmount, eftposCodes, mx51Code, payType, _paymentMethodsRef$cu, data, isSynced, _orderId, _method$metadata, service_charge, _interaction$utils2, _interaction$utils2$p;
|
246
255
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
247
256
|
while (1) switch (_context2.prev = _context2.next) {
|
248
257
|
case 0:
|
249
|
-
_ref4 = method || {}, id = _ref4.id, code = _ref4.code, name = _ref4.name, type = _ref4.type;
|
258
|
+
_ref4 = method || {}, id = _ref4.id, code = _ref4.code, name = _ref4.name, type = _ref4.type;
|
259
|
+
finalAmount = (_method$totalAmount = method.totalAmount) !== null && _method$totalAmount !== void 0 ? _method$totalAmount : customAmount; // 这里需要根据支付方式来判断是 eftpos 还是 mx51
|
250
260
|
eftposCodes = ['EFTPOS_LINKLY', 'EFTPOS_PAYO', 'EFTPOS_WINDCAVE', 'EFTPOS_TYRO'];
|
251
261
|
mx51Code = 'EFTPOS';
|
252
262
|
payType = '';
|
@@ -256,32 +266,32 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
256
266
|
payType = 'mx51';
|
257
267
|
}
|
258
268
|
if (!payType) {
|
259
|
-
_context2.next =
|
269
|
+
_context2.next = 23;
|
260
270
|
break;
|
261
271
|
}
|
262
|
-
_context2.next =
|
272
|
+
_context2.next = 9;
|
263
273
|
return checkoutModule.isCurrentOrderSynced();
|
264
|
-
case
|
274
|
+
case 9:
|
265
275
|
isSynced = _context2.sent;
|
266
276
|
if (isSynced) {
|
267
|
-
_context2.next =
|
277
|
+
_context2.next = 16;
|
268
278
|
break;
|
269
279
|
}
|
270
|
-
_context2.next =
|
280
|
+
_context2.next = 13;
|
271
281
|
return checkoutModule.manualSyncOrderAsync();
|
272
|
-
case
|
282
|
+
case 13:
|
273
283
|
data = _context2.sent;
|
274
|
-
_context2.next =
|
284
|
+
_context2.next = 20;
|
275
285
|
break;
|
276
|
-
case
|
277
|
-
_context2.next =
|
286
|
+
case 16:
|
287
|
+
_context2.next = 18;
|
278
288
|
return checkoutModule.getCurrentOrderId();
|
279
|
-
case
|
280
|
-
|
289
|
+
case 18:
|
290
|
+
_orderId = _context2.sent;
|
281
291
|
data = {
|
282
|
-
orderId:
|
292
|
+
orderId: _orderId
|
283
293
|
};
|
284
|
-
case
|
294
|
+
case 20:
|
285
295
|
(_paymentMethodsRef$cu = paymentMethodsRef.current) === null || _paymentMethodsRef$cu === void 0 || _paymentMethodsRef$cu.onPay(payType, {
|
286
296
|
source: 'normal',
|
287
297
|
data: {
|
@@ -294,7 +304,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
294
304
|
params: {
|
295
305
|
orderId: data.orderId,
|
296
306
|
symbol: getData('shop_symbol'),
|
297
|
-
amount:
|
307
|
+
amount: finalAmount,
|
298
308
|
surcharge: processSurcharge(method.surcharge)
|
299
309
|
},
|
300
310
|
mode: 'pay'
|
@@ -345,9 +355,9 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
345
355
|
}
|
346
356
|
}
|
347
357
|
});
|
348
|
-
_context2.next =
|
358
|
+
_context2.next = 28;
|
349
359
|
break;
|
350
|
-
case
|
360
|
+
case 23:
|
351
361
|
service_charge = null;
|
352
362
|
if (method !== null && method !== void 0 && method.fixed || method !== null && method !== void 0 && method.percentage) {
|
353
363
|
service_charge = {
|
@@ -355,10 +365,26 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
355
365
|
percentage: (method === null || method === void 0 ? void 0 : method.percentage) || '0'
|
356
366
|
};
|
357
367
|
}
|
368
|
+
// 如果是自定义支付并且开启了钱箱,则先打开钱箱
|
369
|
+
if (method.type === 'custom' && (_method$metadata = method.metadata) !== null && _method$metadata !== void 0 && _method$metadata.order_open_cash_drawer) {
|
370
|
+
logger === null || logger === void 0 || logger.addLog({
|
371
|
+
type: 'info',
|
372
|
+
title: 'open_till',
|
373
|
+
metadata: {}
|
374
|
+
});
|
375
|
+
// handleToastClose();
|
376
|
+
interaction === null || interaction === void 0 || (_interaction$utils2 = interaction.utils) === null || _interaction$utils2 === void 0 || (_interaction$utils2$p = _interaction$utils2.postMessageToApp) === null || _interaction$utils2$p === void 0 || _interaction$utils2$p.call(_interaction$utils2, {
|
377
|
+
module: 'till',
|
378
|
+
key: 'open_till',
|
379
|
+
data: {
|
380
|
+
type: 'cash' // cash 不需要验证钱箱权限
|
381
|
+
}
|
382
|
+
});
|
383
|
+
}
|
358
384
|
// 从支付方式列表中查找现金支付方式
|
359
|
-
_context2.next =
|
385
|
+
_context2.next = 28;
|
360
386
|
return checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.addPaymentItemAsync({
|
361
|
-
amount:
|
387
|
+
amount: finalAmount,
|
362
388
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
363
389
|
code: method.code,
|
364
390
|
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
@@ -372,7 +398,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
372
398
|
/** 支付手续费 */
|
373
399
|
service_charge: service_charge
|
374
400
|
});
|
375
|
-
case
|
401
|
+
case 28:
|
376
402
|
case "end":
|
377
403
|
return _context2.stop();
|
378
404
|
}
|
@@ -438,6 +464,9 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
438
464
|
return _ref6.apply(this, arguments);
|
439
465
|
};
|
440
466
|
}());
|
467
|
+
checkoutModule.getCurrentOrderPaymentItemsAsync().then(function (items) {
|
468
|
+
setPaymentItems(items);
|
469
|
+
});
|
441
470
|
}
|
442
471
|
}, [checkoutModule, orderInfo]);
|
443
472
|
|
@@ -494,9 +523,11 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
494
523
|
});
|
495
524
|
var orderSubmitStartUnsubscribe = core.effects.on(CheckoutHooks.OnOrderSubmitStart, function () {
|
496
525
|
var _Toast$loading;
|
526
|
+
setSyncingLock(true);
|
497
527
|
Toast === null || Toast === void 0 || (_Toast$loading = Toast.loading) === null || _Toast$loading === void 0 || _Toast$loading.call(Toast);
|
498
528
|
});
|
499
529
|
var orderSubmitEndUnsubscribe = core.effects.on(CheckoutHooks.OnOrderSubmitEnd, function (res) {
|
530
|
+
setSyncingLock(false);
|
500
531
|
if (res.success) {
|
501
532
|
var _Toast$hide;
|
502
533
|
Toast === null || Toast === void 0 || (_Toast$hide = Toast.hide) === null || _Toast$hide === void 0 || _Toast$hide.call(Toast);
|
@@ -522,22 +553,46 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
522
553
|
// );
|
523
554
|
var orderPaymentAddedUnsubscribe = core.effects.on(CheckoutHooks.OnOrderPaymentAdded, /*#__PURE__*/function () {
|
524
555
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
|
525
|
-
var balanceDueAmount, autoCloseConfig,
|
556
|
+
var orderInfo, balanceDueAmount, autoCloseConfig, _paymentItems, _totalAmount, serviceChargeTotal, paymentMethodName, isCashPayment, _interaction$utils3, _interaction$utils3$p;
|
526
557
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
527
558
|
while (1) switch (_context5.prev = _context5.next) {
|
528
559
|
case 0:
|
529
560
|
console.log('orderPaymentAddedUnsubscribe>>>>', data);
|
561
|
+
// 需要更新 order_info
|
562
|
+
orderInfo = checkoutModule.getCurrentOrderInfo();
|
563
|
+
updateOrderInfo === null || updateOrderInfo === void 0 || updateOrderInfo(orderInfo);
|
530
564
|
balanceDueAmount = checkoutModule.getBalanceDueAmount();
|
531
565
|
if (!(Number(balanceDueAmount) > 0)) {
|
532
|
-
_context5.next =
|
566
|
+
_context5.next = 13;
|
533
567
|
break;
|
534
568
|
}
|
535
569
|
autoCloseConfig = calculateAutoCloseConfig('partially_paid', false); // 获取订单总金额
|
536
|
-
|
537
|
-
|
570
|
+
_context5.next = 8;
|
571
|
+
return checkoutModule.getCurrentOrderPaymentItemsAsync();
|
572
|
+
case 8:
|
573
|
+
_paymentItems = _context5.sent;
|
574
|
+
_totalAmount = new Decimal(orderInfo.isDeposit ? orderInfo.depositAmount : orderInfo.totalAmount); // 如果现在有支付项了,而且还有手续费产生,totalAmount 的计算需要加上手续费
|
575
|
+
if (_paymentItems.length > 0 && _paymentItems.filter(function (n) {
|
576
|
+
return n.isSynced;
|
577
|
+
}).some(function (item) {
|
578
|
+
return item.service_charge;
|
579
|
+
})) {
|
580
|
+
serviceChargeTotal = _paymentItems.reduce(function (acc, item) {
|
581
|
+
var _item$service_charge, _item$service_charge2;
|
582
|
+
var chargeAmount = new Decimal(((_item$service_charge = item.service_charge) === null || _item$service_charge === void 0 ? void 0 : _item$service_charge.amount) || 0);
|
583
|
+
var chargePercentage = new Decimal(((_item$service_charge2 = item.service_charge) === null || _item$service_charge2 === void 0 ? void 0 : _item$service_charge2.percentage) || 0);
|
584
|
+
var itemAmount = new Decimal(item.amount || 0);
|
585
|
+
var itemServiceCharge = chargeAmount.add(chargePercentage.mul(itemAmount));
|
586
|
+
return acc.add(itemServiceCharge);
|
587
|
+
}, new Decimal(0));
|
588
|
+
_totalAmount = _totalAmount.add(serviceChargeTotal);
|
589
|
+
}
|
590
|
+
|
591
|
+
// 根据支付状态展示不同的 toast
|
592
|
+
_context5.next = 13;
|
538
593
|
return displayPaymentResultToast({
|
539
594
|
paymentStatus: 'partially_paid',
|
540
|
-
orderTotalAmount:
|
595
|
+
orderTotalAmount: _totalAmount.toNumber(),
|
541
596
|
gapAmount: balanceDueAmount,
|
542
597
|
failureReason: '',
|
543
598
|
autoCloseConfig: autoCloseConfig,
|
@@ -552,7 +607,26 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
552
607
|
// 不自动关闭Modal,让两个弹窗独立管理
|
553
608
|
}
|
554
609
|
}));
|
555
|
-
case
|
610
|
+
case 13:
|
611
|
+
// 判断是否为现金支付
|
612
|
+
paymentMethodName = data.paymentMethodName || data.name || '';
|
613
|
+
isCashPayment = data.paymentMethodCode === 'CASHMANUAL' || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
|
614
|
+
if (isCashPayment) {
|
615
|
+
logger === null || logger === void 0 || logger.addLog({
|
616
|
+
type: 'info',
|
617
|
+
title: 'open_till',
|
618
|
+
metadata: {}
|
619
|
+
});
|
620
|
+
// handleToastClose();
|
621
|
+
interaction === null || interaction === void 0 || (_interaction$utils3 = interaction.utils) === null || _interaction$utils3 === void 0 || (_interaction$utils3$p = _interaction$utils3.postMessageToApp) === null || _interaction$utils3$p === void 0 || _interaction$utils3$p.call(_interaction$utils3, {
|
622
|
+
module: 'till',
|
623
|
+
key: 'open_till',
|
624
|
+
data: {
|
625
|
+
type: 'cash' // cash 不需要验证钱箱权限
|
626
|
+
}
|
627
|
+
});
|
628
|
+
}
|
629
|
+
case 16:
|
556
630
|
case "end":
|
557
631
|
return _context5.stop();
|
558
632
|
}
|
@@ -655,7 +729,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
655
729
|
// 当 walletpass 直接就满足订单支付时,触发此方法
|
656
730
|
var handleWalletPassConfirmPay = /*#__PURE__*/function () {
|
657
731
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(action) {
|
658
|
-
var result, _result$response, responseData, _responseData$payment, params;
|
732
|
+
var result, _result$response, _orderInfo, responseData, _responseData$payment, params;
|
659
733
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
660
734
|
while (1) switch (_context8.prev = _context8.next) {
|
661
735
|
case 0:
|
@@ -682,31 +756,43 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
682
756
|
_context8.next = 12;
|
683
757
|
return showSuccessToast === null || showSuccessToast === void 0 ? void 0 : showSuccessToast(result);
|
684
758
|
case 12:
|
685
|
-
if (result.success) {
|
686
|
-
|
687
|
-
|
688
|
-
try {
|
689
|
-
params = {
|
690
|
-
type: '99',
|
691
|
-
// 打印订单全部信息
|
692
|
-
data: {
|
693
|
-
order_id: responseData.order_id,
|
694
|
-
machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
|
695
|
-
small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment = responseData.payment_info) === null || _responseData$payment === void 0 ? void 0 : _responseData$payment.small_ticket_data,
|
696
|
-
machine_code_print_info_v2: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info_v2
|
697
|
-
}
|
698
|
-
};
|
699
|
-
console.log('print_order_onOrderSynced_params>>>>', params);
|
700
|
-
nativePrint(params, function (res) {
|
701
|
-
console.log('print_order_onOrderSynced_res>>>>', res);
|
702
|
-
});
|
703
|
-
} catch (error) {
|
704
|
-
console.error('print_order_onOrderSynced_error>>>>', error);
|
705
|
-
}
|
706
|
-
// 支付成功时关闭 PaymentModal
|
707
|
-
onPaymentCancel(true);
|
759
|
+
if (!result.success) {
|
760
|
+
_context8.next = 22;
|
761
|
+
break;
|
708
762
|
}
|
709
|
-
|
763
|
+
// 检查订单此时是不是定金支付订单
|
764
|
+
_orderInfo = checkoutModule.getCurrentOrderInfo();
|
765
|
+
setCurrentEditOrderId === null || setCurrentEditOrderId === void 0 || setCurrentEditOrderId(result.orderId);
|
766
|
+
if (!(result.is_deposit && Number(_orderInfo.depositAmount < _orderInfo.totalAmount))) {
|
767
|
+
_context8.next = 18;
|
768
|
+
break;
|
769
|
+
}
|
770
|
+
updateOrderInfo === null || updateOrderInfo === void 0 || updateOrderInfo(_orderInfo);
|
771
|
+
return _context8.abrupt("return");
|
772
|
+
case 18:
|
773
|
+
responseData = (_result$response = result.response) === null || _result$response === void 0 ? void 0 : _result$response.data; // 打印订单完整信息
|
774
|
+
console.log('print_order_onOrderSynced>>>>', result);
|
775
|
+
try {
|
776
|
+
params = {
|
777
|
+
type: '99',
|
778
|
+
// 打印订单全部信息
|
779
|
+
data: {
|
780
|
+
order_id: responseData.order_id,
|
781
|
+
machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
|
782
|
+
small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment = responseData.payment_info) === null || _responseData$payment === void 0 ? void 0 : _responseData$payment.small_ticket_data,
|
783
|
+
machine_code_print_info_v2: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info_v2
|
784
|
+
}
|
785
|
+
};
|
786
|
+
console.log('print_order_onOrderSynced_params>>>>', params);
|
787
|
+
nativePrint(params, function (res) {
|
788
|
+
console.log('print_order_onOrderSynced_res>>>>', res);
|
789
|
+
});
|
790
|
+
} catch (error) {
|
791
|
+
console.error('print_order_onOrderSynced_error>>>>', error);
|
792
|
+
}
|
793
|
+
// 支付成功时关闭 PaymentModal
|
794
|
+
onPaymentCancel(true);
|
795
|
+
case 22:
|
710
796
|
case "end":
|
711
797
|
return _context8.stop();
|
712
798
|
}
|
@@ -838,6 +924,11 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
838
924
|
return 0;
|
839
925
|
}
|
840
926
|
}, [state, showPriceAdjustModal]);
|
927
|
+
|
928
|
+
// 手动折扣后订单总价
|
929
|
+
var currentTotalPriceAfterDiscount = useMemo(function () {
|
930
|
+
return new Decimal(currentTotalPrice).minus(state.shop_discount || 0).toNumber();
|
931
|
+
}, [state.shop_discount, currentTotalPrice]);
|
841
932
|
var handleSelectWalletChange = useMemoizedFn( /*#__PURE__*/function () {
|
842
933
|
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(select) {
|
843
934
|
var voucherItems, data;
|
@@ -851,7 +942,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
851
942
|
voucherItems = [];
|
852
943
|
select.forEach(function (item) {
|
853
944
|
var mapCode = item.code ? WALLET_PASS_CODE_MAP[item.code] : null;
|
854
|
-
if (mapCode) {
|
945
|
+
if (mapCode && walletPassDetail.map[mapCode]) {
|
855
946
|
var _walletPassDetail$map, _walletPassDetail$map2, _walletPassDetail$map3, _walletPassDetail$map4;
|
856
947
|
voucherItems.push({
|
857
948
|
/** 支付金额 */
|
@@ -895,32 +986,19 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
895
986
|
|
896
987
|
// 手动折扣相关处理函数
|
897
988
|
var handlePriceAdjustConfirm = /*#__PURE__*/function () {
|
898
|
-
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(
|
899
|
-
var ScheduleModule, _getSumTotal2, productAmount, discountAmount;
|
989
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(discountAmount) {
|
900
990
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
901
991
|
while (1) switch (_context11.prev = _context11.next) {
|
902
992
|
case 0:
|
903
993
|
try {
|
904
994
|
if (checkoutModule && orderInfo !== null && orderInfo !== void 0 && orderInfo.totalAmount) {
|
905
995
|
if (dispatch) {
|
906
|
-
ScheduleModule = pisellosAllModule.ScheduleModule;
|
907
|
-
_getSumTotal2 = getSumTotal(state, {
|
908
|
-
isEdit: true,
|
909
|
-
ScheduleModule: ScheduleModule
|
910
|
-
}), productAmount = _getSumTotal2.productAmount; // 计算折扣金额(商品总金额 - 新价格)
|
911
|
-
// 存储正数:正数表示折扣,0表示无折扣
|
912
|
-
discountAmount = Math.max(0, productAmount - newPrice); // 转换为金额字符串格式(2位小数)
|
913
|
-
// const discountAmountStr = formatAmount(discountAmount, 2, '');
|
914
|
-
// 修改os 中折扣的数据
|
915
|
-
// await checkoutModule.updateShopDiscountAsync(discountAmountStr);
|
916
|
-
// 同步修改购物车的数据
|
917
996
|
dispatch({
|
918
997
|
type: 'setState',
|
919
998
|
payload: {
|
920
999
|
shop_discount: discountAmount
|
921
1000
|
}
|
922
1001
|
});
|
923
|
-
// 修改 pisellos 中 shop_discount 的值
|
924
1002
|
}
|
925
1003
|
}
|
926
1004
|
} catch (error) {
|
@@ -940,7 +1018,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
940
1018
|
var handleButtonClick = /*#__PURE__*/function () {
|
941
1019
|
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(key) {
|
942
1020
|
var _savePayLaterHandlerR;
|
943
|
-
var data, isSynced,
|
1021
|
+
var data, isSynced, _orderId2, params, _paymentItems2;
|
944
1022
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
945
1023
|
while (1) switch (_context12.prev = _context12.next) {
|
946
1024
|
case 0:
|
@@ -973,9 +1051,9 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
973
1051
|
_context12.next = 19;
|
974
1052
|
return checkoutModule.getCurrentOrderId();
|
975
1053
|
case 19:
|
976
|
-
|
1054
|
+
_orderId2 = _context12.sent;
|
977
1055
|
data = {
|
978
|
-
orderId:
|
1056
|
+
orderId: _orderId2
|
979
1057
|
};
|
980
1058
|
case 21:
|
981
1059
|
console.log('handleButtonClick_print-receipt_data>>>>', data);
|
@@ -1010,8 +1088,8 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1010
1088
|
_context12.next = 29;
|
1011
1089
|
return checkoutModule.getCurrentOrderPaymentItemsAsync();
|
1012
1090
|
case 29:
|
1013
|
-
|
1014
|
-
if (!(
|
1091
|
+
_paymentItems2 = _context12.sent;
|
1092
|
+
if (!(_paymentItems2 !== null && _paymentItems2 !== void 0 && _paymentItems2.length)) {
|
1015
1093
|
_context12.next = 33;
|
1016
1094
|
break;
|
1017
1095
|
}
|
@@ -1169,7 +1247,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1169
1247
|
onSearch: handleSearch
|
1170
1248
|
}, searchAndClientProps)), moduleConfig.showWalletPass && /*#__PURE__*/React.createElement(WalletPassModule, {
|
1171
1249
|
clientId: state === null || state === void 0 || (_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id,
|
1172
|
-
customAmount:
|
1250
|
+
customAmount: balanceDueAmount,
|
1173
1251
|
orderInfo: orderInfo || undefined,
|
1174
1252
|
ref: walletPassRef,
|
1175
1253
|
paymentItems: paymentItems,
|
@@ -1197,8 +1275,10 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1197
1275
|
gridRow: '1'
|
1198
1276
|
} : {}
|
1199
1277
|
}, /*#__PURE__*/React.createElement(CashPaymentModule, {
|
1278
|
+
disabled: isOrderFree,
|
1200
1279
|
isModalOpen: isModalOpen,
|
1201
|
-
|
1280
|
+
syncingLock: syncingLock,
|
1281
|
+
amountSymbol: getData('shop_symbol'),
|
1202
1282
|
orderInfo: orderInfo || undefined,
|
1203
1283
|
onPaymentComplete: handleAddCashPayment,
|
1204
1284
|
amountButtons: recommendAmounts,
|
@@ -1246,34 +1326,20 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1246
1326
|
return setPaymentLinkModalOpen(false);
|
1247
1327
|
},
|
1248
1328
|
sendPaymentLink: handleSendCustomerPaymentLink
|
1249
|
-
}),
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
background: 'transparent',
|
1257
|
-
width: '100%',
|
1258
|
-
height: '100%',
|
1259
|
-
position: 'absolute',
|
1260
|
-
top: 0,
|
1261
|
-
left: 0
|
1262
|
-
},
|
1263
|
-
onClick: function onClick() {
|
1264
|
-
return setShowPriceAdjustModal(false);
|
1329
|
+
}), /*#__PURE__*/React.createElement(DiscountKeyboard, {
|
1330
|
+
containerProps: {
|
1331
|
+
renderType: 'modal',
|
1332
|
+
open: showPriceAdjustModal,
|
1333
|
+
onCancel: function onCancel() {
|
1334
|
+
return setShowPriceAdjustModal(false);
|
1335
|
+
}
|
1265
1336
|
},
|
1266
|
-
"aria-label": locales.getText('pisell2.checkout.modal.close-price-adjustment') || 'Close price adjustment modal'
|
1267
|
-
}), /*#__PURE__*/React.createElement("div", {
|
1268
|
-
className: "pisell-price-adjust-container"
|
1269
|
-
}, /*#__PURE__*/React.createElement(PisellAdjustPrice, {
|
1270
1337
|
selectType: "dark",
|
1271
|
-
|
1272
|
-
|
1273
|
-
onChange: handlePriceAdjustConfirm,
|
1338
|
+
originalValue: currentTotalPrice,
|
1339
|
+
defaultValue: currentTotalPriceAfterDiscount,
|
1274
1340
|
resetText: locales.getText('pisell2.checkout.modal.reset-price-adjustment'),
|
1275
|
-
|
1276
|
-
})
|
1341
|
+
onEnter: handlePriceAdjustConfirm
|
1342
|
+
}), /*#__PURE__*/React.createElement(SavePayLaterHandler, {
|
1277
1343
|
ref: savePayLaterHandlerRef,
|
1278
1344
|
amountSymbol: state.amountSymbol,
|
1279
1345
|
walletPassData: walletPassData,
|
@@ -1290,33 +1356,39 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1290
1356
|
callback = _ref18.callback,
|
1291
1357
|
onClose = _ref18.onClose,
|
1292
1358
|
dispatch = _ref18.dispatch,
|
1293
|
-
state = _ref18.state
|
1359
|
+
state = _ref18.state,
|
1360
|
+
setEditCartMode = _ref18.setEditCartMode,
|
1361
|
+
editOrderId = _ref18.editOrderId;
|
1294
1362
|
var context = useEngineContext();
|
1295
1363
|
locales.init(checkoutLocales, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get('umi_locale')) || 'en');
|
1296
1364
|
var _ref19 = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
1297
1365
|
pisellos = _ref19.pisellos,
|
1298
1366
|
getData = _ref19.getData,
|
1299
1367
|
interaction = _ref19.interaction;
|
1300
|
-
var
|
1301
|
-
_useState22 = _slicedToArray(_useState21, 2),
|
1302
|
-
orderInfo = _useState22[0],
|
1303
|
-
setOrderInfo = _useState22[1];
|
1304
|
-
var _useState23 = useState(0),
|
1368
|
+
var _useState23 = useState(null),
|
1305
1369
|
_useState24 = _slicedToArray(_useState23, 2),
|
1306
|
-
|
1307
|
-
|
1308
|
-
var _useState25 = useState(
|
1370
|
+
orderInfo = _useState24[0],
|
1371
|
+
setOrderInfo = _useState24[1];
|
1372
|
+
var _useState25 = useState(0),
|
1309
1373
|
_useState26 = _slicedToArray(_useState25, 2),
|
1310
|
-
|
1311
|
-
|
1312
|
-
var _useState27 = useState(
|
1374
|
+
totalAmount = _useState26[0],
|
1375
|
+
setTotalAmount = _useState26[1];
|
1376
|
+
var _useState27 = useState(true),
|
1313
1377
|
_useState28 = _slicedToArray(_useState27, 2),
|
1314
|
-
|
1315
|
-
|
1316
|
-
var _useState29 = useState(
|
1378
|
+
actualShowCashPayment = _useState28[0],
|
1379
|
+
setActualShowCashPayment = _useState28[1];
|
1380
|
+
var _useState29 = useState(0),
|
1317
1381
|
_useState30 = _slicedToArray(_useState29, 2),
|
1318
|
-
|
1319
|
-
|
1382
|
+
windowHeight = _useState30[0],
|
1383
|
+
setWindowHeight = _useState30[1];
|
1384
|
+
var _useState31 = useState(false),
|
1385
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
1386
|
+
showRetryModal = _useState32[0],
|
1387
|
+
setShowRetryModal = _useState32[1];
|
1388
|
+
var _useState33 = useState(editOrderId || 0),
|
1389
|
+
_useState34 = _slicedToArray(_useState33, 2),
|
1390
|
+
currentEditOrderId = _useState34[0],
|
1391
|
+
_setCurrentEditOrderId = _useState34[1];
|
1320
1392
|
var Toast = useToast();
|
1321
1393
|
var _usePrinter2 = usePrinter(),
|
1322
1394
|
nativePrint = _usePrinter2.nativePrint;
|
@@ -1383,17 +1455,17 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1383
1455
|
|
1384
1456
|
// 初始化 tillButton 数据
|
1385
1457
|
useEffect(function () {
|
1386
|
-
var _interaction$
|
1458
|
+
var _interaction$utils5;
|
1387
1459
|
var initTillButtonData = /*#__PURE__*/function () {
|
1388
1460
|
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
1389
|
-
var _interaction$
|
1461
|
+
var _interaction$utils4, _interaction$utils4$a, tillButtonData;
|
1390
1462
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
1391
1463
|
while (1) switch (_context16.prev = _context16.next) {
|
1392
1464
|
case 0:
|
1393
1465
|
console.log('准备获取tillButton数据');
|
1394
1466
|
_context16.prev = 1;
|
1395
1467
|
_context16.next = 4;
|
1396
|
-
return interaction === null || interaction === void 0 || (_interaction$
|
1468
|
+
return interaction === null || interaction === void 0 || (_interaction$utils4 = interaction.utils) === null || _interaction$utils4 === void 0 || (_interaction$utils4$a = _interaction$utils4.asyncDataManager) === null || _interaction$utils4$a === void 0 ? void 0 : _interaction$utils4$a.call(_interaction$utils4, {
|
1397
1469
|
module: 'get',
|
1398
1470
|
key: 'till_button'
|
1399
1471
|
});
|
@@ -1423,7 +1495,7 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1423
1495
|
}();
|
1424
1496
|
|
1425
1497
|
// 只在 PaymentModal 打开时初始化 tillButton 数据
|
1426
|
-
if (interaction !== null && interaction !== void 0 && (_interaction$
|
1498
|
+
if (interaction !== null && interaction !== void 0 && (_interaction$utils5 = interaction.utils) !== null && _interaction$utils5 !== void 0 && _interaction$utils5.asyncDataManager) {
|
1427
1499
|
initTillButtonData();
|
1428
1500
|
}
|
1429
1501
|
}, [interaction]);
|
@@ -1437,7 +1509,7 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1437
1509
|
var matrix = new DOMMatrix(bodyTransform);
|
1438
1510
|
scaleY = matrix.d;
|
1439
1511
|
}
|
1440
|
-
return "".concat(Math.floor(
|
1512
|
+
return "".concat(Math.floor(windowHeight * 0.9 / scaleY), "px");
|
1441
1513
|
}, [windowHeight]);
|
1442
1514
|
|
1443
1515
|
// 模块配置 - 控制显示哪些支付模块
|
@@ -1451,23 +1523,23 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1451
1523
|
}, []);
|
1452
1524
|
|
1453
1525
|
// 订单备注相关状态
|
1454
|
-
var
|
1455
|
-
_useState32 = _slicedToArray(_useState31, 2),
|
1456
|
-
noteModalOpen = _useState32[0],
|
1457
|
-
setNoteModalOpen = _useState32[1];
|
1458
|
-
var _useState33 = useState(''),
|
1459
|
-
_useState34 = _slicedToArray(_useState33, 2),
|
1460
|
-
orderNote = _useState34[0],
|
1461
|
-
setOrderNote = _useState34[1];
|
1462
|
-
var _useState35 = useState('payment-content'),
|
1526
|
+
var _useState35 = useState(false),
|
1463
1527
|
_useState36 = _slicedToArray(_useState35, 2),
|
1464
|
-
|
1465
|
-
|
1528
|
+
noteModalOpen = _useState36[0],
|
1529
|
+
setNoteModalOpen = _useState36[1];
|
1530
|
+
var _useState37 = useState(''),
|
1531
|
+
_useState38 = _slicedToArray(_useState37, 2),
|
1532
|
+
orderNote = _useState38[0],
|
1533
|
+
setOrderNote = _useState38[1];
|
1534
|
+
var _useState39 = useState('payment-content'),
|
1535
|
+
_useState40 = _slicedToArray(_useState39, 2),
|
1536
|
+
noteModalSource = _useState40[0],
|
1537
|
+
setNoteModalSource = _useState40[1];
|
1466
1538
|
|
1467
1539
|
// 订单备注相关处理函数
|
1468
1540
|
var handleNoteConfirm = /*#__PURE__*/function () {
|
1469
1541
|
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(noteValue) {
|
1470
|
-
var checkoutModule,
|
1542
|
+
var checkoutModule, _orderId3, _checkoutModule$editO, _checkoutModule, _checkoutModule$updat;
|
1471
1543
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
1472
1544
|
while (1) switch (_context17.prev = _context17.next) {
|
1473
1545
|
case 0:
|
@@ -1476,9 +1548,9 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1476
1548
|
break;
|
1477
1549
|
}
|
1478
1550
|
checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
1479
|
-
|
1551
|
+
_orderId3 = checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.getCurrentOrderId();
|
1480
1552
|
if (checkoutModule) {
|
1481
|
-
(_checkoutModule$editO = checkoutModule.editOrderNoteByOrderIdAsync) === null || _checkoutModule$editO === void 0 || _checkoutModule$editO.call(checkoutModule,
|
1553
|
+
(_checkoutModule$editO = checkoutModule.editOrderNoteByOrderIdAsync) === null || _checkoutModule$editO === void 0 || _checkoutModule$editO.call(checkoutModule, _orderId3, noteValue);
|
1482
1554
|
setOrderNote(noteValue);
|
1483
1555
|
Toast === null || Toast === void 0 || Toast.success(locales.getText('pisell2.checkout.order-note.updated-successfully'));
|
1484
1556
|
}
|
@@ -1620,19 +1692,19 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1620
1692
|
};
|
1621
1693
|
var handleNoteConfirm = /*#__PURE__*/function () {
|
1622
1694
|
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(noteValue) {
|
1623
|
-
var checkoutModule,
|
1695
|
+
var checkoutModule, _orderId4, _checkoutModule$editO2;
|
1624
1696
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
1625
1697
|
while (1) switch (_context19.prev = _context19.next) {
|
1626
1698
|
case 0:
|
1627
1699
|
_context19.prev = 0;
|
1628
1700
|
checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
1629
|
-
|
1630
|
-
if (!(checkoutModule &&
|
1701
|
+
_orderId4 = checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.getCurrentOrderId();
|
1702
|
+
if (!(checkoutModule && _orderId4)) {
|
1631
1703
|
_context19.next = 8;
|
1632
1704
|
break;
|
1633
1705
|
}
|
1634
1706
|
_context19.next = 6;
|
1635
|
-
return (_checkoutModule$editO2 = checkoutModule.editOrderNoteByOrderIdAsync) === null || _checkoutModule$editO2 === void 0 ? void 0 : _checkoutModule$editO2.call(checkoutModule,
|
1707
|
+
return (_checkoutModule$editO2 = checkoutModule.editOrderNoteByOrderIdAsync) === null || _checkoutModule$editO2 === void 0 ? void 0 : _checkoutModule$editO2.call(checkoutModule, _orderId4, noteValue);
|
1636
1708
|
case 6:
|
1637
1709
|
setOrderNote(noteValue);
|
1638
1710
|
showToast('success', locales.getText('pisell2.checkout.order-note.updated-successfully'));
|
@@ -1662,19 +1734,19 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1662
1734
|
}();
|
1663
1735
|
var handleNoteDelete = /*#__PURE__*/function () {
|
1664
1736
|
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
1665
|
-
var checkoutModule,
|
1737
|
+
var checkoutModule, _orderId5, _checkoutModule$editO3;
|
1666
1738
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
1667
1739
|
while (1) switch (_context20.prev = _context20.next) {
|
1668
1740
|
case 0:
|
1669
1741
|
_context20.prev = 0;
|
1670
1742
|
checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
1671
|
-
|
1672
|
-
if (!(checkoutModule &&
|
1743
|
+
_orderId5 = checkoutModule === null || checkoutModule === void 0 ? void 0 : checkoutModule.getCurrentOrderId();
|
1744
|
+
if (!(checkoutModule && _orderId5)) {
|
1673
1745
|
_context20.next = 8;
|
1674
1746
|
break;
|
1675
1747
|
}
|
1676
1748
|
_context20.next = 6;
|
1677
|
-
return (_checkoutModule$editO3 = checkoutModule.editOrderNoteByOrderIdAsync) === null || _checkoutModule$editO3 === void 0 ? void 0 : _checkoutModule$editO3.call(checkoutModule,
|
1749
|
+
return (_checkoutModule$editO3 = checkoutModule.editOrderNoteByOrderIdAsync) === null || _checkoutModule$editO3 === void 0 ? void 0 : _checkoutModule$editO3.call(checkoutModule, _orderId5, '');
|
1678
1750
|
case 6:
|
1679
1751
|
setOrderNote('');
|
1680
1752
|
showToast('success', locales.getText('pisell2.checkout.order-note.deleted-successfully'));
|
@@ -1820,6 +1892,52 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1820
1892
|
onClose === null || onClose === void 0 || onClose(reset || false);
|
1821
1893
|
};
|
1822
1894
|
|
1895
|
+
// 如果订单已经同步过,此时点击左上角返回,需要通知购物车进入编辑态
|
1896
|
+
var handleSetEditCartMode = /*#__PURE__*/function () {
|
1897
|
+
var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
1898
|
+
var closeModal,
|
1899
|
+
checkout,
|
1900
|
+
orderId,
|
1901
|
+
paymentData,
|
1902
|
+
paidAmount,
|
1903
|
+
paidAmountWithoutSurcharge,
|
1904
|
+
_args21 = arguments;
|
1905
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
1906
|
+
while (1) switch (_context21.prev = _context21.next) {
|
1907
|
+
case 0:
|
1908
|
+
closeModal = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : false;
|
1909
|
+
checkout = pisellos.getModule('checkout');
|
1910
|
+
orderId = checkout.getCurrentOrderId();
|
1911
|
+
_context21.next = 5;
|
1912
|
+
return checkout.getCurrentOrderPaymentItemsAsync();
|
1913
|
+
case 5:
|
1914
|
+
paymentData = _context21.sent;
|
1915
|
+
// 计算订单已付款和已付款(不包含手续费)的金额
|
1916
|
+
paidAmount = paymentData.reduce(function (total, item) {
|
1917
|
+
return total + Number(item.amount);
|
1918
|
+
}, 0);
|
1919
|
+
paidAmountWithoutSurcharge = paymentData.reduce(function (total, item) {
|
1920
|
+
var _item$service_charge3;
|
1921
|
+
return total + Number(item.amount) - Number(((_item$service_charge3 = item.service_charge) === null || _item$service_charge3 === void 0 ? void 0 : _item$service_charge3.amount) || 0);
|
1922
|
+
}, 0);
|
1923
|
+
console.log('paidAmount>>>>', paidAmount, paidAmountWithoutSurcharge);
|
1924
|
+
// 清空临时选择的 voucher
|
1925
|
+
checkout.updateVoucherPaymentItemsAsync([]);
|
1926
|
+
setEditCartMode === null || setEditCartMode === void 0 || setEditCartMode(orderId, {
|
1927
|
+
paidAmount: paidAmount,
|
1928
|
+
paidAmountWithoutSurcharge: paidAmountWithoutSurcharge
|
1929
|
+
}, closeModal);
|
1930
|
+
case 11:
|
1931
|
+
case "end":
|
1932
|
+
return _context21.stop();
|
1933
|
+
}
|
1934
|
+
}, _callee21);
|
1935
|
+
}));
|
1936
|
+
return function handleSetEditCartMode() {
|
1937
|
+
return _ref27.apply(this, arguments);
|
1938
|
+
};
|
1939
|
+
}();
|
1940
|
+
|
1823
1941
|
// 自定义头部组件
|
1824
1942
|
var CustomHeader = function CustomHeader() {
|
1825
1943
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -1836,7 +1954,7 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1836
1954
|
onClick: function onClick() {
|
1837
1955
|
var checkout = pisellos.getModule('checkout');
|
1838
1956
|
if (checkout.isCurrentOrderSynced()) {
|
1839
|
-
|
1957
|
+
handleSetEditCartMode(true);
|
1840
1958
|
} else {
|
1841
1959
|
handlePaymentCancel(false);
|
1842
1960
|
}
|
@@ -1868,23 +1986,23 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1868
1986
|
// 初始化checkout数据
|
1869
1987
|
useEffect(function () {
|
1870
1988
|
var initCheckoutData = /*#__PURE__*/function () {
|
1871
|
-
var
|
1872
|
-
var checkout, _newData$subtotal_inf,
|
1873
|
-
return _regeneratorRuntime().wrap(function
|
1874
|
-
while (1) switch (
|
1989
|
+
var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
1990
|
+
var checkout, shop_wallet_pass_id, newData, _newData$subtotal_inf, _newData$subtotal_inf2, _orderInfo2, _data$subtotal_info, _data$subtotal_info2, _orderInfo4;
|
1991
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
1992
|
+
while (1) switch (_context23.prev = _context23.next) {
|
1875
1993
|
case 0:
|
1876
|
-
|
1994
|
+
_context23.prev = 0;
|
1877
1995
|
// 获取 checkout 模块并处理订单数据
|
1878
1996
|
checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
1879
1997
|
if (!(checkout && data && !isLocalOrderCreated.current)) {
|
1880
|
-
|
1998
|
+
_context23.next = 24;
|
1881
1999
|
break;
|
1882
2000
|
}
|
1883
2001
|
isLocalOrderCreated.current = true;
|
1884
|
-
|
2002
|
+
_context23.next = 6;
|
1885
2003
|
return getShopWalletPassId(interaction);
|
1886
2004
|
case 6:
|
1887
|
-
shop_wallet_pass_id =
|
2005
|
+
shop_wallet_pass_id = _context23.sent;
|
1888
2006
|
checkout.setOtherParams({
|
1889
2007
|
is_price_include_tax: getData('is_price_include_tax'),
|
1890
2008
|
tax_rate: getData('tax_rate') || '10',
|
@@ -1899,16 +2017,33 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1899
2017
|
});
|
1900
2018
|
newData = cloneDeep(data); // setTotalAmount(newData.total.expectAmount);
|
1901
2019
|
// 先往 checkout 解决方案推送一条 local 数据
|
1902
|
-
|
1903
|
-
|
2020
|
+
if (!(editOrderId || currentEditOrderId)) {
|
2021
|
+
_context23.next = 14;
|
2022
|
+
break;
|
2023
|
+
}
|
2024
|
+
_context23.next = 12;
|
2025
|
+
return checkout.updateLocalOrderAsync({
|
2026
|
+
orderId: editOrderId || currentEditOrderId,
|
1904
2027
|
orderData: newData.order_info,
|
1905
2028
|
cartSummary: (_newData$subtotal_inf = newData.subtotal_info) === null || _newData$subtotal_inf === void 0 ? void 0 : _newData$subtotal_inf.subTotalList,
|
1906
2029
|
autoPayment: true,
|
1907
2030
|
totalInfo: newData.subtotal_info
|
1908
2031
|
});
|
1909
|
-
case
|
2032
|
+
case 12:
|
2033
|
+
_context23.next = 16;
|
2034
|
+
break;
|
2035
|
+
case 14:
|
2036
|
+
_context23.next = 16;
|
2037
|
+
return checkout.createLocalOrderAsync({
|
2038
|
+
orderData: newData.order_info,
|
2039
|
+
cartSummary: (_newData$subtotal_inf2 = newData.subtotal_info) === null || _newData$subtotal_inf2 === void 0 ? void 0 : _newData$subtotal_inf2.subTotalList,
|
2040
|
+
autoPayment: true,
|
2041
|
+
totalInfo: newData.subtotal_info
|
2042
|
+
});
|
2043
|
+
case 16:
|
1910
2044
|
// 获取订单总金额
|
1911
2045
|
_orderInfo2 = checkout.getCurrentOrderInfo();
|
2046
|
+
console.log(_orderInfo2);
|
1912
2047
|
if (_orderInfo2 && _orderInfo2.totalAmount) {
|
1913
2048
|
setTotalAmount(_orderInfo2.totalAmount);
|
1914
2049
|
}
|
@@ -1924,37 +2059,40 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1924
2059
|
}
|
1925
2060
|
// 监听订单同步完成,同步完成后显示订单完成 toast,关闭当前弹窗
|
1926
2061
|
unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', /*#__PURE__*/function () {
|
1927
|
-
var
|
2062
|
+
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(data) {
|
1928
2063
|
var _data$response, _responseData$payment2;
|
1929
|
-
var responseData, paymentStatus, orderTotalAmount, gapAmount, currentChangeGivenAmount, failureReason, _interaction$
|
1930
|
-
return _regeneratorRuntime().wrap(function
|
1931
|
-
while (1) switch (
|
2064
|
+
var currentOrderId, responseData, paymentStatus, orderTotalAmount, gapAmount, currentChangeGivenAmount, failureReason, _interaction$utils6, _interaction$utils6$a, _responseData$payment3, params, statusClassName, autoCloseConfig, enabledAutoPrint, _orderInfo3, paymentResult;
|
2065
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
2066
|
+
while (1) switch (_context22.prev = _context22.next) {
|
1932
2067
|
case 0:
|
2068
|
+
// handleSetEditCartMode(false)
|
2069
|
+
currentOrderId = checkout.getCurrentOrderId();
|
2070
|
+
_setCurrentEditOrderId(currentOrderId);
|
1933
2071
|
// 获取支付状态和相关信息
|
1934
2072
|
responseData = (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.data; // 获取支付状态
|
1935
2073
|
paymentStatus = responseData === null || responseData === void 0 ? void 0 : responseData.payment_status;
|
1936
2074
|
if (!data.isManual) {
|
1937
|
-
|
2075
|
+
_context22.next = 6;
|
1938
2076
|
break;
|
1939
2077
|
}
|
1940
|
-
return
|
1941
|
-
case
|
2078
|
+
return _context22.abrupt("return");
|
2079
|
+
case 6:
|
1942
2080
|
handlePaymentComplete(data);
|
1943
2081
|
// 如果正在显示现金支付 toast,跳过自动关闭逻辑
|
1944
2082
|
if (!showingCashToastRef.current) {
|
1945
|
-
|
2083
|
+
_context22.next = 9;
|
1946
2084
|
break;
|
1947
2085
|
}
|
1948
|
-
return
|
1949
|
-
case
|
2086
|
+
return _context22.abrupt("return");
|
2087
|
+
case 9:
|
1950
2088
|
// 获取订单总金额
|
1951
2089
|
orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
|
1952
2090
|
gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
|
1953
|
-
currentChangeGivenAmount = Number(
|
2091
|
+
currentChangeGivenAmount = Number(responseData === null || responseData === void 0 || (_responseData$payment2 = responseData.payment_info) === null || _responseData$payment2 === void 0 ? void 0 : _responseData$payment2.current_change_given_amount); // const changeDue = Number(responseData?.amount_gap || 0);
|
1954
2092
|
// 获取失败原因
|
1955
2093
|
failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason; // 根据支付状态弹出对应的支付结果toast
|
1956
2094
|
if (!paymentStatus) {
|
1957
|
-
|
2095
|
+
_context22.next = 30;
|
1958
2096
|
break;
|
1959
2097
|
}
|
1960
2098
|
// 打印订单完整信息
|
@@ -2009,23 +2147,24 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2009
2147
|
// 确定支付状态
|
2010
2148
|
statusClassName = calculateStatusClassName(paymentStatus);
|
2011
2149
|
autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
|
2012
|
-
|
2013
|
-
return interaction === null || interaction === void 0 || (_interaction$
|
2150
|
+
_context22.next = 21;
|
2151
|
+
return interaction === null || interaction === void 0 || (_interaction$utils6 = interaction.utils) === null || _interaction$utils6 === void 0 || (_interaction$utils6$a = _interaction$utils6.asyncDataManager) === null || _interaction$utils6$a === void 0 ? void 0 : _interaction$utils6$a.call(_interaction$utils6, {
|
2014
2152
|
module: 'get',
|
2015
2153
|
key: 'auto_print_receipt'
|
2016
2154
|
});
|
2017
|
-
case
|
2018
|
-
enabledAutoPrint =
|
2019
|
-
|
2155
|
+
case 21:
|
2156
|
+
enabledAutoPrint = _context22.sent;
|
2157
|
+
_orderInfo3 = checkout.getCurrentOrderInfo(); // 根据支付状态展示不同的 toast
|
2158
|
+
_context22.next = 25;
|
2020
2159
|
return displayPaymentResultToast({
|
2021
2160
|
paymentStatus: paymentStatus,
|
2022
|
-
orderTotalAmount: orderTotalAmount,
|
2161
|
+
orderTotalAmount: _orderInfo3.isDeposit ? _orderInfo3.depositAmount : orderTotalAmount,
|
2023
2162
|
gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
|
2024
2163
|
failureReason: failureReason,
|
2025
2164
|
autoCloseConfig: autoCloseConfig,
|
2026
2165
|
actionButtons: generateActionButtons(paymentStatus, enabledAutoPrint)
|
2027
2166
|
}, paymentResultToastConfig);
|
2028
|
-
case
|
2167
|
+
case 25:
|
2029
2168
|
// 当支付状态为 paid 时,关闭 paymentModal
|
2030
2169
|
if (paymentStatus === 'paid') {
|
2031
2170
|
handleModalClose();
|
@@ -2041,70 +2180,86 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2041
2180
|
}
|
2042
2181
|
});
|
2043
2182
|
handlePaymentComplete(paymentResult);
|
2044
|
-
|
2183
|
+
_context22.next = 31;
|
2045
2184
|
break;
|
2046
|
-
case
|
2185
|
+
case 30:
|
2047
2186
|
handlePaymentComplete(data);
|
2048
|
-
case
|
2187
|
+
case 31:
|
2049
2188
|
case "end":
|
2050
|
-
return
|
2189
|
+
return _context22.stop();
|
2051
2190
|
}
|
2052
|
-
},
|
2191
|
+
}, _callee22);
|
2053
2192
|
}));
|
2054
2193
|
return function (_x17) {
|
2055
|
-
return
|
2194
|
+
return _ref29.apply(this, arguments);
|
2056
2195
|
};
|
2057
2196
|
}());
|
2058
|
-
|
2197
|
+
_context23.next = 40;
|
2059
2198
|
break;
|
2060
|
-
case
|
2199
|
+
case 24:
|
2061
2200
|
if (!isLocalOrderCreated.current) {
|
2062
|
-
|
2201
|
+
_context23.next = 40;
|
2063
2202
|
break;
|
2064
2203
|
}
|
2065
2204
|
// // 如果本地订单已创建,这时候还更新了 data,则需要销毁当前的订单数据,然后更新新的订单数据了
|
2066
2205
|
console.log('🔄 PaymentModal: data changed, updating checkout data...');
|
2067
2206
|
isLocalOrderCreated.current = false;
|
2068
|
-
|
2207
|
+
_context23.next = 29;
|
2069
2208
|
return checkout.cancelCurrentOrderAsync();
|
2070
|
-
case
|
2071
|
-
|
2072
|
-
|
2209
|
+
case 29:
|
2210
|
+
if (!(editOrderId || currentEditOrderId)) {
|
2211
|
+
_context23.next = 34;
|
2212
|
+
break;
|
2213
|
+
}
|
2214
|
+
_context23.next = 32;
|
2215
|
+
return checkout.updateLocalOrderAsync({
|
2216
|
+
orderId: editOrderId || currentEditOrderId,
|
2073
2217
|
orderData: data === null || data === void 0 ? void 0 : data.order_info,
|
2074
2218
|
cartSummary: data === null || data === void 0 || (_data$subtotal_info = data.subtotal_info) === null || _data$subtotal_info === void 0 ? void 0 : _data$subtotal_info.subTotalList,
|
2075
2219
|
autoPayment: true,
|
2076
2220
|
totalInfo: data === null || data === void 0 ? void 0 : data.subtotal_info
|
2077
2221
|
});
|
2078
|
-
case
|
2222
|
+
case 32:
|
2223
|
+
_context23.next = 36;
|
2224
|
+
break;
|
2225
|
+
case 34:
|
2226
|
+
_context23.next = 36;
|
2227
|
+
return checkout.createLocalOrderAsync({
|
2228
|
+
orderData: data === null || data === void 0 ? void 0 : data.order_info,
|
2229
|
+
cartSummary: data === null || data === void 0 || (_data$subtotal_info2 = data.subtotal_info) === null || _data$subtotal_info2 === void 0 ? void 0 : _data$subtotal_info2.subTotalList,
|
2230
|
+
autoPayment: true,
|
2231
|
+
totalInfo: data === null || data === void 0 ? void 0 : data.subtotal_info
|
2232
|
+
});
|
2233
|
+
case 36:
|
2079
2234
|
// 获取订单总金额
|
2080
|
-
|
2081
|
-
if (
|
2082
|
-
setTotalAmount(
|
2235
|
+
_orderInfo4 = checkout.getCurrentOrderInfo();
|
2236
|
+
if (_orderInfo4 && _orderInfo4.totalAmount) {
|
2237
|
+
setTotalAmount(_orderInfo4.totalAmount);
|
2083
2238
|
}
|
2084
|
-
setOrderInfo(
|
2239
|
+
setOrderInfo(_orderInfo4);
|
2085
2240
|
isLocalOrderCreated.current = true;
|
2086
|
-
case
|
2087
|
-
|
2241
|
+
case 40:
|
2242
|
+
_context23.next = 46;
|
2088
2243
|
break;
|
2089
|
-
case
|
2090
|
-
|
2091
|
-
|
2092
|
-
console.error('Failed to initialize checkout data:',
|
2244
|
+
case 42:
|
2245
|
+
_context23.prev = 42;
|
2246
|
+
_context23.t0 = _context23["catch"](0);
|
2247
|
+
console.error('Failed to initialize checkout data:', _context23.t0);
|
2093
2248
|
logger === null || logger === void 0 || logger.addLog({
|
2094
2249
|
type: 'error',
|
2095
2250
|
title: 'Failed to initialize checkout data',
|
2096
2251
|
metadata: {
|
2097
|
-
error:
|
2252
|
+
error: _context23.t0
|
2098
2253
|
}
|
2099
2254
|
});
|
2100
|
-
case
|
2255
|
+
case 46:
|
2101
2256
|
case "end":
|
2102
|
-
return
|
2257
|
+
return _context23.stop();
|
2103
2258
|
}
|
2104
|
-
},
|
2259
|
+
}, _callee23, null, [[0, 42]]);
|
2105
2260
|
}));
|
2106
2261
|
return function initCheckoutData() {
|
2107
|
-
return
|
2262
|
+
return _ref28.apply(this, arguments);
|
2108
2263
|
};
|
2109
2264
|
}();
|
2110
2265
|
if (data) {
|
@@ -2140,11 +2295,11 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2140
2295
|
|
2141
2296
|
// 通用回调函数
|
2142
2297
|
var handleDetailsClick = /*#__PURE__*/function () {
|
2143
|
-
var
|
2298
|
+
var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
2144
2299
|
var _context$appHelper2;
|
2145
|
-
var _context$appHelper$ut9, isTerminal, isWebPos, checkout,
|
2146
|
-
return _regeneratorRuntime().wrap(function
|
2147
|
-
while (1) switch (
|
2300
|
+
var _context$appHelper$ut9, isTerminal, isWebPos, checkout, _orderId6;
|
2301
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
2302
|
+
while (1) switch (_context24.prev = _context24.next) {
|
2148
2303
|
case 0:
|
2149
2304
|
setTimeout(function () {
|
2150
2305
|
// 主动关闭PaymentResultToast
|
@@ -2153,37 +2308,37 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2153
2308
|
}, 0);
|
2154
2309
|
_context$appHelper$ut9 = (_context$appHelper2 = context.appHelper) === null || _context$appHelper2 === void 0 ? void 0 : _context$appHelper2.utils, isTerminal = _context$appHelper$ut9.isTerminal, isWebPos = _context$appHelper$ut9.isWebPos;
|
2155
2310
|
if (!(isTerminal !== null && isTerminal !== void 0 && isTerminal())) {
|
2156
|
-
|
2311
|
+
_context24.next = 8;
|
2157
2312
|
break;
|
2158
2313
|
}
|
2159
2314
|
checkout = pisellos.getModule('checkout');
|
2160
|
-
|
2315
|
+
_context24.next = 6;
|
2161
2316
|
return checkout.getCurrentOrderId();
|
2162
2317
|
case 6:
|
2163
|
-
|
2164
|
-
return
|
2318
|
+
_orderId6 = _context24.sent;
|
2319
|
+
return _context24.abrupt("return", interaction.utils.postMessageToApp({
|
2165
2320
|
module: 'booking',
|
2166
2321
|
key: 'view_order',
|
2167
2322
|
data: {
|
2168
|
-
order_id:
|
2323
|
+
order_id: _orderId6
|
2169
2324
|
},
|
2170
2325
|
origin: '/booking'
|
2171
2326
|
}));
|
2172
2327
|
case 8:
|
2173
2328
|
case "end":
|
2174
|
-
return
|
2329
|
+
return _context24.stop();
|
2175
2330
|
}
|
2176
|
-
},
|
2331
|
+
}, _callee24);
|
2177
2332
|
}));
|
2178
2333
|
return function handleDetailsClick() {
|
2179
|
-
return
|
2334
|
+
return _ref30.apply(this, arguments);
|
2180
2335
|
};
|
2181
2336
|
}();
|
2182
2337
|
var handlePrintReceiptClick = /*#__PURE__*/function () {
|
2183
|
-
var
|
2184
|
-
var checkoutModule, data, isSynced,
|
2185
|
-
return _regeneratorRuntime().wrap(function
|
2186
|
-
while (1) switch (
|
2338
|
+
var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
2339
|
+
var checkoutModule, data, isSynced, _orderId7, params;
|
2340
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
2341
|
+
while (1) switch (_context25.prev = _context25.next) {
|
2187
2342
|
case 0:
|
2188
2343
|
setTimeout(function () {
|
2189
2344
|
// 主动关闭PaymentResultToast
|
@@ -2192,32 +2347,32 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2192
2347
|
}, 0);
|
2193
2348
|
checkoutModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
2194
2349
|
if (checkoutModule) {
|
2195
|
-
|
2350
|
+
_context25.next = 4;
|
2196
2351
|
break;
|
2197
2352
|
}
|
2198
|
-
return
|
2353
|
+
return _context25.abrupt("return");
|
2199
2354
|
case 4:
|
2200
|
-
|
2355
|
+
_context25.next = 6;
|
2201
2356
|
return checkoutModule.isCurrentOrderSynced();
|
2202
2357
|
case 6:
|
2203
|
-
isSynced =
|
2358
|
+
isSynced = _context25.sent;
|
2204
2359
|
if (isSynced) {
|
2205
|
-
|
2360
|
+
_context25.next = 13;
|
2206
2361
|
break;
|
2207
2362
|
}
|
2208
|
-
|
2363
|
+
_context25.next = 10;
|
2209
2364
|
return checkoutModule.manualSyncOrderAsync();
|
2210
2365
|
case 10:
|
2211
|
-
data =
|
2212
|
-
|
2366
|
+
data = _context25.sent;
|
2367
|
+
_context25.next = 17;
|
2213
2368
|
break;
|
2214
2369
|
case 13:
|
2215
|
-
|
2370
|
+
_context25.next = 15;
|
2216
2371
|
return checkoutModule.getCurrentOrderId();
|
2217
2372
|
case 15:
|
2218
|
-
|
2373
|
+
_orderId7 = _context25.sent;
|
2219
2374
|
data = {
|
2220
|
-
orderId:
|
2375
|
+
orderId: _orderId7
|
2221
2376
|
};
|
2222
2377
|
case 17:
|
2223
2378
|
// data.orderId 就是订单号,可以用来打印小票
|
@@ -2241,12 +2396,12 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2241
2396
|
}
|
2242
2397
|
case 18:
|
2243
2398
|
case "end":
|
2244
|
-
return
|
2399
|
+
return _context25.stop();
|
2245
2400
|
}
|
2246
|
-
},
|
2401
|
+
}, _callee25);
|
2247
2402
|
}));
|
2248
2403
|
return function handlePrintReceiptClick() {
|
2249
|
-
return
|
2404
|
+
return _ref31.apply(this, arguments);
|
2250
2405
|
};
|
2251
2406
|
}();
|
2252
2407
|
var handleRetryClick = function handleRetryClick() {
|
@@ -2319,6 +2474,20 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2319
2474
|
className: getClassName('menu-icon')
|
2320
2475
|
}),
|
2321
2476
|
onClick: handleOrderNoteClick
|
2477
|
+
}, enabledAutoPrint ? {
|
2478
|
+
key: 'print',
|
2479
|
+
label: locales.getText('payment.result.printReceipt'),
|
2480
|
+
icon: /*#__PURE__*/React.createElement(Printer, {
|
2481
|
+
className: getClassName('action-icon')
|
2482
|
+
}),
|
2483
|
+
onClick: handlePrintReceiptClick
|
2484
|
+
} : {
|
2485
|
+
key: 'details',
|
2486
|
+
label: locales.getText('payment.result.details'),
|
2487
|
+
icon: /*#__PURE__*/React.createElement(FileCheck02, {
|
2488
|
+
className: getClassName('action-icon')
|
2489
|
+
}),
|
2490
|
+
onClick: handleDetailsClick
|
2322
2491
|
}],
|
2323
2492
|
buttonProps: {
|
2324
2493
|
className: getClassName('action-button'),
|
@@ -2329,7 +2498,7 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2329
2498
|
}]];
|
2330
2499
|
case 'partially_paid':
|
2331
2500
|
// 部分支付状态
|
2332
|
-
return [[{
|
2501
|
+
return [[enabledAutoPrint ? {
|
2333
2502
|
id: 'details',
|
2334
2503
|
buttonProps: {
|
2335
2504
|
className: getClassName('action-button'),
|
@@ -2339,6 +2508,16 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2339
2508
|
}),
|
2340
2509
|
children: locales.getText('payment.result.details')
|
2341
2510
|
}
|
2511
|
+
} : {
|
2512
|
+
id: 'print',
|
2513
|
+
buttonProps: {
|
2514
|
+
className: getClassName('action-button'),
|
2515
|
+
onClick: handlePrintReceiptClick,
|
2516
|
+
icon: /*#__PURE__*/React.createElement(Printer, {
|
2517
|
+
className: getClassName('action-icon')
|
2518
|
+
}),
|
2519
|
+
children: locales.getText('payment.result.printReceipt')
|
2520
|
+
}
|
2342
2521
|
}, {
|
2343
2522
|
id: 'more',
|
2344
2523
|
isMore: true,
|
@@ -2349,6 +2528,20 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2349
2528
|
className: getClassName('menu-icon')
|
2350
2529
|
}),
|
2351
2530
|
onClick: handleOrderNoteClick
|
2531
|
+
}, enabledAutoPrint ? {
|
2532
|
+
key: 'print',
|
2533
|
+
label: locales.getText('payment.result.printReceipt'),
|
2534
|
+
icon: /*#__PURE__*/React.createElement(Printer, {
|
2535
|
+
className: getClassName('action-icon')
|
2536
|
+
}),
|
2537
|
+
onClick: handlePrintReceiptClick
|
2538
|
+
} : {
|
2539
|
+
key: 'details',
|
2540
|
+
label: locales.getText('payment.result.details'),
|
2541
|
+
icon: /*#__PURE__*/React.createElement(FileCheck02, {
|
2542
|
+
className: getClassName('action-icon')
|
2543
|
+
}),
|
2544
|
+
onClick: handleDetailsClick
|
2352
2545
|
}],
|
2353
2546
|
buttonProps: {
|
2354
2547
|
className: getClassName('action-button'),
|
@@ -2521,7 +2714,13 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2521
2714
|
return setShowRetryModal(true);
|
2522
2715
|
},
|
2523
2716
|
generateActionButtons: generateActionButtons,
|
2524
|
-
paymentResultToastConfig: paymentResultToastConfig
|
2717
|
+
paymentResultToastConfig: paymentResultToastConfig,
|
2718
|
+
updateOrderInfo: function updateOrderInfo(orderInfo) {
|
2719
|
+
return setOrderInfo(orderInfo);
|
2720
|
+
},
|
2721
|
+
setCurrentEditOrderId: function setCurrentEditOrderId(orderId) {
|
2722
|
+
return _setCurrentEditOrderId(orderId);
|
2723
|
+
}
|
2525
2724
|
})), noteModalOpen && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(NoteModal, {
|
2526
2725
|
open: noteModalOpen,
|
2527
2726
|
title: locales.getText('pisell2.text.add-order-notes'),
|
@@ -2536,10 +2735,10 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2536
2735
|
open: showRetryModal,
|
2537
2736
|
title: locales.getText('pisell2.checkout.tips'),
|
2538
2737
|
footer: null,
|
2539
|
-
closable: false,
|
2540
|
-
maskClosable: false,
|
2541
2738
|
keyboard: false,
|
2542
|
-
onCancel: function onCancel() {
|
2739
|
+
onCancel: function onCancel() {
|
2740
|
+
setShowRetryModal(false);
|
2741
|
+
} // 禁用关闭
|
2543
2742
|
}
|
2544
2743
|
}, /*#__PURE__*/React.createElement("div", {
|
2545
2744
|
style: {
|