@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
@@ -66,6 +66,7 @@ var import_utils = require("@pisell/utils");
|
|
66
66
|
var import_utils2 = require("./info/service2/utils");
|
67
67
|
var import_lodash = require("lodash");
|
68
68
|
var import_utilsByBooking = require("./info2/utilsByBooking");
|
69
|
+
var import_decimal = __toESM(require("decimal.js"));
|
69
70
|
var Request = class {
|
70
71
|
request = {};
|
71
72
|
constructor() {
|
@@ -611,22 +612,26 @@ var getServerItemExtend = (state, cacheItem, timeObj) => {
|
|
611
612
|
};
|
612
613
|
var getProductTotalPrice = (item) => {
|
613
614
|
var _a;
|
614
|
-
let price =
|
615
|
+
let price = new import_decimal.default(item._extend.price || 0);
|
615
616
|
let other = (_a = item._extend) == null ? void 0 : _a.other;
|
616
617
|
if (other == null ? void 0 : other.product_variant_id) {
|
617
|
-
price =
|
618
|
+
price = new import_decimal.default((other == null ? void 0 : other.price) || 0);
|
618
619
|
}
|
619
620
|
if (other == null ? void 0 : other.bundle) {
|
620
621
|
price = other == null ? void 0 : other.bundle.reduce((accumulator, currentValue) => {
|
621
|
-
|
622
|
+
const currentPrice = new import_decimal.default(currentValue.price || 0);
|
623
|
+
const currentNum = new import_decimal.default(currentValue.num || 0);
|
624
|
+
return accumulator.add(currentPrice.mul(currentNum));
|
622
625
|
}, price);
|
623
626
|
}
|
624
627
|
if (other == null ? void 0 : other.option) {
|
625
628
|
price = other == null ? void 0 : other.option.reduce((accumulator, currentValue) => {
|
626
|
-
|
629
|
+
const currentPrice = new import_decimal.default(currentValue.price || 0);
|
630
|
+
const currentNum = new import_decimal.default(currentValue.num || 0);
|
631
|
+
return accumulator.add(currentPrice.mul(currentNum));
|
627
632
|
}, price);
|
628
633
|
}
|
629
|
-
return price;
|
634
|
+
return price.toNumber();
|
630
635
|
};
|
631
636
|
var getDuration = (duration) => {
|
632
637
|
if (typeof duration === "number") {
|
@@ -23,6 +23,8 @@ interface PaymentModalProps {
|
|
23
23
|
}
|
24
24
|
interface PaymentModalMainProps extends PaymentModalProps {
|
25
25
|
onClose?: (reset?: boolean) => void;
|
26
|
+
setEditCartMode?: (order_id: number, payData: any, closeModal: boolean) => void;
|
27
|
+
editOrderId?: number;
|
26
28
|
}
|
27
29
|
declare const PaymentModal: React.FC<PaymentModalMainProps>;
|
28
30
|
export type { PaymentModalData, PaymentModalProps };
|
@@ -33,6 +33,7 @@ __export(PaymentModal_exports, {
|
|
33
33
|
});
|
34
34
|
module.exports = __toCommonJS(PaymentModal_exports);
|
35
35
|
var import_react = __toESM(require("react"));
|
36
|
+
var import_decimal = __toESM(require("decimal.js"));
|
36
37
|
var import_utils = require("@pisell/utils");
|
37
38
|
var import_locales = require("../../utils/locales");
|
38
39
|
var import_ahooks = require("ahooks");
|
@@ -63,6 +64,7 @@ var import_utils2 = require("./utils");
|
|
63
64
|
var import_usePaymentLogger = __toESM(require("./hooks/usePaymentLogger"));
|
64
65
|
var import_antd = require("antd");
|
65
66
|
var import_printer = __toESM(require("../../hooks/printer"));
|
67
|
+
var import_priceKeyboard = require("../../pro/priceKeyboard");
|
66
68
|
var CheckoutHooks = {
|
67
69
|
OnStateAmountChanged: "checkout:onStateAmountChanged",
|
68
70
|
OnBalanceDueAmountChanged: "checkout:onBalanceDueAmountChanged",
|
@@ -94,7 +96,9 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
94
96
|
dynamicMaxHeight = "600px",
|
95
97
|
onOrderSyncFailed,
|
96
98
|
generateActionButtons,
|
97
|
-
paymentResultToastConfig
|
99
|
+
paymentResultToastConfig,
|
100
|
+
updateOrderInfo,
|
101
|
+
setCurrentEditOrderId
|
98
102
|
}, ref) => {
|
99
103
|
var _a, _b, _c;
|
100
104
|
const context = (0, import_useEngineContext.default)();
|
@@ -117,6 +121,7 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
117
121
|
const [paymentItems, setPaymentItems] = (0, import_react.useState)([]);
|
118
122
|
const [walletPassData, setWalletPassData] = (0, import_react.useState)({});
|
119
123
|
const { nativePrint } = (0, import_printer.default)();
|
124
|
+
const [syncingLock, setSyncingLock] = (0, import_react.useState)(false);
|
120
125
|
const isOrderFree = (0, import_react.useMemo)(() => {
|
121
126
|
if (!customAmount) return false;
|
122
127
|
const amount = parseFloat(customAmount);
|
@@ -148,6 +153,19 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
148
153
|
return method.code === "CASHMANUAL" || method.type === "CASHMANUAL" || ((_a3 = method.name) == null ? void 0 : _a3.toLowerCase().includes("cash"));
|
149
154
|
}
|
150
155
|
);
|
156
|
+
logger == null ? void 0 : logger.addLog({
|
157
|
+
type: "info",
|
158
|
+
title: "open_till",
|
159
|
+
metadata: {}
|
160
|
+
});
|
161
|
+
(_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
|
162
|
+
module: "till",
|
163
|
+
key: "open_till",
|
164
|
+
data: {
|
165
|
+
type: "cash"
|
166
|
+
// cash 不需要验证钱箱权限
|
167
|
+
}
|
168
|
+
});
|
151
169
|
await (checkoutModule == null ? void 0 : checkoutModule.addPaymentItemAsync({
|
152
170
|
amount: result.amount,
|
153
171
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
@@ -162,23 +180,11 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
162
180
|
voucher_id: 0,
|
163
181
|
rounding_amount: result.roundingAmount
|
164
182
|
}));
|
165
|
-
logger == null ? void 0 : logger.addLog({
|
166
|
-
type: "info",
|
167
|
-
title: "open_till",
|
168
|
-
metadata: {}
|
169
|
-
});
|
170
|
-
(_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
|
171
|
-
module: "till",
|
172
|
-
key: "open_till",
|
173
|
-
data: {
|
174
|
-
type: "cash"
|
175
|
-
// cash 不需要验证钱箱权限
|
176
|
-
}
|
177
|
-
});
|
178
183
|
};
|
179
184
|
const processSurcharge = (surcharge) => {
|
180
185
|
if (typeof surcharge === "string") {
|
181
|
-
|
186
|
+
const match = surcharge.match(/\d+(?:\.\d+)?/);
|
187
|
+
return match ? match[0] : void 0;
|
182
188
|
}
|
183
189
|
if (typeof surcharge === "number") {
|
184
190
|
return String(surcharge);
|
@@ -186,8 +192,9 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
186
192
|
return surcharge;
|
187
193
|
};
|
188
194
|
const onPaymentOptionClick = async (method) => {
|
189
|
-
var _a2;
|
195
|
+
var _a2, _b2, _c2, _d;
|
190
196
|
const { id, code, name, type } = method || {};
|
197
|
+
const finalAmount = method.totalAmount ?? customAmount;
|
191
198
|
const eftposCodes = [
|
192
199
|
"EFTPOS_LINKLY",
|
193
200
|
"EFTPOS_PAYO",
|
@@ -219,7 +226,7 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
219
226
|
params: {
|
220
227
|
orderId: data.orderId,
|
221
228
|
symbol: getData("shop_symbol"),
|
222
|
-
amount:
|
229
|
+
amount: finalAmount,
|
223
230
|
surcharge: processSurcharge(method.surcharge)
|
224
231
|
},
|
225
232
|
mode: "pay"
|
@@ -274,8 +281,23 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
274
281
|
percentage: (method == null ? void 0 : method.percentage) || "0"
|
275
282
|
};
|
276
283
|
}
|
284
|
+
if (method.type === "custom" && ((_b2 = method.metadata) == null ? void 0 : _b2.order_open_cash_drawer)) {
|
285
|
+
logger == null ? void 0 : logger.addLog({
|
286
|
+
type: "info",
|
287
|
+
title: "open_till",
|
288
|
+
metadata: {}
|
289
|
+
});
|
290
|
+
(_d = (_c2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _c2.postMessageToApp) == null ? void 0 : _d.call(_c2, {
|
291
|
+
module: "till",
|
292
|
+
key: "open_till",
|
293
|
+
data: {
|
294
|
+
type: "cash"
|
295
|
+
// cash 不需要验证钱箱权限
|
296
|
+
}
|
297
|
+
});
|
298
|
+
}
|
277
299
|
await (checkoutModule == null ? void 0 : checkoutModule.addPaymentItemAsync({
|
278
|
-
amount:
|
300
|
+
amount: finalAmount,
|
279
301
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
280
302
|
code: method.code,
|
281
303
|
/** 支付类型id,跟支付列表上对应的支付方式保持一致 */
|
@@ -329,6 +351,9 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
329
351
|
);
|
330
352
|
}
|
331
353
|
});
|
354
|
+
checkoutModule.getCurrentOrderPaymentItemsAsync().then((items) => {
|
355
|
+
setPaymentItems(items);
|
356
|
+
});
|
332
357
|
}
|
333
358
|
}, [checkoutModule, orderInfo]);
|
334
359
|
(0, import_react.useEffect)(() => {
|
@@ -390,6 +415,7 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
390
415
|
CheckoutHooks.OnOrderSubmitStart,
|
391
416
|
() => {
|
392
417
|
var _a2;
|
418
|
+
setSyncingLock(true);
|
393
419
|
(_a2 = Toast == null ? void 0 : Toast.loading) == null ? void 0 : _a2.call(Toast);
|
394
420
|
}
|
395
421
|
);
|
@@ -397,6 +423,7 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
397
423
|
CheckoutHooks.OnOrderSubmitEnd,
|
398
424
|
(res) => {
|
399
425
|
var _a2, _b2;
|
426
|
+
setSyncingLock(false);
|
400
427
|
if (res.success) {
|
401
428
|
(_a2 = Toast == null ? void 0 : Toast.hide) == null ? void 0 : _a2.call(Toast);
|
402
429
|
} else {
|
@@ -414,18 +441,33 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
414
441
|
const orderPaymentAddedUnsubscribe = core.effects.on(
|
415
442
|
CheckoutHooks.OnOrderPaymentAdded,
|
416
443
|
async (data) => {
|
444
|
+
var _a2, _b2;
|
417
445
|
console.log("orderPaymentAddedUnsubscribe>>>>", data);
|
446
|
+
const orderInfo2 = checkoutModule.getCurrentOrderInfo();
|
447
|
+
updateOrderInfo == null ? void 0 : updateOrderInfo(orderInfo2);
|
418
448
|
const balanceDueAmount2 = checkoutModule.getBalanceDueAmount();
|
419
449
|
if (Number(balanceDueAmount2) > 0) {
|
420
450
|
const autoCloseConfig = (0, import_PaymentResultToastUtils.calculateAutoCloseConfig)(
|
421
451
|
"partially_paid",
|
422
452
|
false
|
423
453
|
);
|
424
|
-
const
|
454
|
+
const paymentItems2 = await checkoutModule.getCurrentOrderPaymentItemsAsync();
|
455
|
+
let totalAmount2 = new import_decimal.default(orderInfo2.isDeposit ? orderInfo2.depositAmount : orderInfo2.totalAmount);
|
456
|
+
if (paymentItems2.length > 0 && paymentItems2.filter((n) => n.isSynced).some((item) => item.service_charge)) {
|
457
|
+
const serviceChargeTotal = paymentItems2.reduce((acc, item) => {
|
458
|
+
var _a3, _b3;
|
459
|
+
const chargeAmount = new import_decimal.default(((_a3 = item.service_charge) == null ? void 0 : _a3.amount) || 0);
|
460
|
+
const chargePercentage = new import_decimal.default(((_b3 = item.service_charge) == null ? void 0 : _b3.percentage) || 0);
|
461
|
+
const itemAmount = new import_decimal.default(item.amount || 0);
|
462
|
+
const itemServiceCharge = chargeAmount.add(chargePercentage.mul(itemAmount));
|
463
|
+
return acc.add(itemServiceCharge);
|
464
|
+
}, new import_decimal.default(0));
|
465
|
+
totalAmount2 = totalAmount2.add(serviceChargeTotal);
|
466
|
+
}
|
425
467
|
await (0, import_PaymentResultToastUtils.displayPaymentResultToast)(
|
426
468
|
{
|
427
469
|
paymentStatus: "partially_paid",
|
428
|
-
orderTotalAmount:
|
470
|
+
orderTotalAmount: totalAmount2.toNumber(),
|
429
471
|
gapAmount: balanceDueAmount2,
|
430
472
|
failureReason: "",
|
431
473
|
autoCloseConfig,
|
@@ -442,6 +484,23 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
442
484
|
}
|
443
485
|
);
|
444
486
|
}
|
487
|
+
const paymentMethodName = data.paymentMethodName || data.name || "";
|
488
|
+
const isCashPayment = data.paymentMethodCode === "CASHMANUAL" || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
|
489
|
+
if (isCashPayment) {
|
490
|
+
logger == null ? void 0 : logger.addLog({
|
491
|
+
type: "info",
|
492
|
+
title: "open_till",
|
493
|
+
metadata: {}
|
494
|
+
});
|
495
|
+
(_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
|
496
|
+
module: "till",
|
497
|
+
key: "open_till",
|
498
|
+
data: {
|
499
|
+
type: "cash"
|
500
|
+
// cash 不需要验证钱箱权限
|
501
|
+
}
|
502
|
+
});
|
503
|
+
}
|
445
504
|
}
|
446
505
|
);
|
447
506
|
return () => {
|
@@ -506,6 +565,12 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
506
565
|
const result = await checkoutModule.manualSyncOrderAsync();
|
507
566
|
await (showSuccessToast == null ? void 0 : showSuccessToast(result));
|
508
567
|
if (result.success) {
|
568
|
+
const orderInfo2 = checkoutModule.getCurrentOrderInfo();
|
569
|
+
setCurrentEditOrderId == null ? void 0 : setCurrentEditOrderId(result.orderId);
|
570
|
+
if (result.is_deposit && Number(orderInfo2.depositAmount < orderInfo2.totalAmount)) {
|
571
|
+
updateOrderInfo == null ? void 0 : updateOrderInfo(orderInfo2);
|
572
|
+
return;
|
573
|
+
}
|
509
574
|
const responseData = (_a2 = result.response) == null ? void 0 : _a2.data;
|
510
575
|
console.log("print_order_onOrderSynced>>>>", result);
|
511
576
|
try {
|
@@ -601,6 +666,9 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
601
666
|
return 0;
|
602
667
|
}
|
603
668
|
}, [state, showPriceAdjustModal]);
|
669
|
+
const currentTotalPriceAfterDiscount = (0, import_react.useMemo)(() => {
|
670
|
+
return new import_decimal.default(currentTotalPrice).minus(state.shop_discount || 0).toNumber();
|
671
|
+
}, [state.shop_discount, currentTotalPrice]);
|
604
672
|
const handleSelectWalletChange = (0, import_ahooks.useMemoizedFn)(
|
605
673
|
async (select) => {
|
606
674
|
if (walletPassDetail.isShow) {
|
@@ -608,7 +676,7 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
608
676
|
select.forEach((item) => {
|
609
677
|
var _a2, _b2, _c2, _d;
|
610
678
|
const mapCode = item.code ? import_constants.WALLET_PASS_CODE_MAP[item.code] : null;
|
611
|
-
if (mapCode) {
|
679
|
+
if (mapCode && walletPassDetail.map[mapCode]) {
|
612
680
|
voucherItems.push({
|
613
681
|
/** 支付金额 */
|
614
682
|
amount: item.amount,
|
@@ -638,16 +706,10 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
638
706
|
}
|
639
707
|
}
|
640
708
|
);
|
641
|
-
const handlePriceAdjustConfirm = async (
|
709
|
+
const handlePriceAdjustConfirm = async (discountAmount) => {
|
642
710
|
try {
|
643
711
|
if (checkoutModule && (orderInfo == null ? void 0 : orderInfo.totalAmount)) {
|
644
712
|
if (dispatch) {
|
645
|
-
const { ScheduleModule } = pisellosAllModule;
|
646
|
-
const { productAmount } = (0, import_amount.getSumTotal)(state, {
|
647
|
-
isEdit: true,
|
648
|
-
ScheduleModule
|
649
|
-
});
|
650
|
-
const discountAmount = Math.max(0, productAmount - newPrice);
|
651
713
|
dispatch({
|
652
714
|
type: "setState",
|
653
715
|
payload: {
|
@@ -820,7 +882,7 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
820
882
|
import_WalletPassModule.default,
|
821
883
|
{
|
822
884
|
clientId: (_b = (_a = state == null ? void 0 : state.client) == null ? void 0 : _a.value) == null ? void 0 : _b.id,
|
823
|
-
customAmount,
|
885
|
+
customAmount: balanceDueAmount,
|
824
886
|
orderInfo: orderInfo || void 0,
|
825
887
|
ref: walletPassRef,
|
826
888
|
paymentItems,
|
@@ -863,8 +925,10 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
863
925
|
/* @__PURE__ */ import_react.default.createElement(
|
864
926
|
import_CashPaymentModule.default,
|
865
927
|
{
|
928
|
+
disabled: isOrderFree,
|
866
929
|
isModalOpen,
|
867
|
-
|
930
|
+
syncingLock,
|
931
|
+
amountSymbol: getData("shop_symbol"),
|
868
932
|
orderInfo: orderInfo || void 0,
|
869
933
|
onPaymentComplete: handleAddCashPayment,
|
870
934
|
amountButtons: recommendAmounts,
|
@@ -938,42 +1002,22 @@ var PaymentContent = (0, import_react.forwardRef)(
|
|
938
1002
|
sendPaymentLink: handleSendCustomerPaymentLink
|
939
1003
|
}
|
940
1004
|
),
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
{
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
"aria-label": import_utils.locales.getText(
|
958
|
-
"pisell2.checkout.modal.close-price-adjustment"
|
959
|
-
) || "Close price adjustment modal"
|
960
|
-
}
|
961
|
-
), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-price-adjust-container" }, /* @__PURE__ */ import_react.default.createElement(
|
962
|
-
import_materials.PisellAdjustPrice,
|
963
|
-
{
|
964
|
-
selectType: "dark",
|
965
|
-
originValue: currentTotalPrice,
|
966
|
-
value: currentTotalPrice,
|
967
|
-
onChange: handlePriceAdjustConfirm,
|
968
|
-
resetText: import_utils.locales.getText(
|
969
|
-
"pisell2.checkout.modal.reset-price-adjustment"
|
970
|
-
),
|
971
|
-
doneText: import_utils.locales.getText(
|
972
|
-
"pisell2.checkout.modal.done-price-adjustment"
|
973
|
-
)
|
974
|
-
}
|
975
|
-
))),
|
976
|
-
document.body
|
1005
|
+
/* @__PURE__ */ import_react.default.createElement(
|
1006
|
+
import_priceKeyboard.DiscountKeyboard,
|
1007
|
+
{
|
1008
|
+
containerProps: {
|
1009
|
+
renderType: "modal",
|
1010
|
+
open: showPriceAdjustModal,
|
1011
|
+
onCancel: () => setShowPriceAdjustModal(false)
|
1012
|
+
},
|
1013
|
+
selectType: "dark",
|
1014
|
+
originalValue: currentTotalPrice,
|
1015
|
+
defaultValue: currentTotalPriceAfterDiscount,
|
1016
|
+
resetText: import_utils.locales.getText(
|
1017
|
+
"pisell2.checkout.modal.reset-price-adjustment"
|
1018
|
+
),
|
1019
|
+
onEnter: handlePriceAdjustConfirm
|
1020
|
+
}
|
977
1021
|
),
|
978
1022
|
/* @__PURE__ */ import_react.default.createElement(
|
979
1023
|
import_SavePayLaterHandler.default,
|
@@ -993,7 +1037,9 @@ var PaymentModal = ({
|
|
993
1037
|
callback,
|
994
1038
|
onClose,
|
995
1039
|
dispatch,
|
996
|
-
state
|
1040
|
+
state,
|
1041
|
+
setEditCartMode,
|
1042
|
+
editOrderId
|
997
1043
|
}) => {
|
998
1044
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
999
1045
|
const context = (0, import_useEngineContext.default)();
|
@@ -1007,6 +1053,7 @@ var PaymentModal = ({
|
|
1007
1053
|
const [actualShowCashPayment, setActualShowCashPayment] = (0, import_react.useState)(true);
|
1008
1054
|
const [windowHeight, setWindowHeight] = (0, import_react.useState)(0);
|
1009
1055
|
const [showRetryModal, setShowRetryModal] = (0, import_react.useState)(false);
|
1056
|
+
const [currentEditOrderId, setCurrentEditOrderId] = (0, import_react.useState)(editOrderId || 0);
|
1010
1057
|
const Toast = (0, import_materials.useToast)();
|
1011
1058
|
const { nativePrint } = (0, import_printer.default)();
|
1012
1059
|
const handleRetry = async () => {
|
@@ -1063,7 +1110,7 @@ var PaymentModal = ({
|
|
1063
1110
|
const matrix = new DOMMatrix(bodyTransform);
|
1064
1111
|
scaleY = matrix.d;
|
1065
1112
|
}
|
1066
|
-
return `${Math.floor(
|
1113
|
+
return `${Math.floor(windowHeight * 0.9 / scaleY)}px`;
|
1067
1114
|
}, [windowHeight]);
|
1068
1115
|
const moduleConfig = {
|
1069
1116
|
showCashPayment: true
|
@@ -1301,6 +1348,21 @@ var PaymentModal = ({
|
|
1301
1348
|
checkout.cancelCurrentOrderAsync();
|
1302
1349
|
onClose == null ? void 0 : onClose(reset || false);
|
1303
1350
|
};
|
1351
|
+
const handleSetEditCartMode = async (closeModal = false) => {
|
1352
|
+
const checkout = pisellos.getModule("checkout");
|
1353
|
+
const orderId = checkout.getCurrentOrderId();
|
1354
|
+
const paymentData = await checkout.getCurrentOrderPaymentItemsAsync();
|
1355
|
+
const paidAmount = paymentData.reduce((total, item) => {
|
1356
|
+
return total + Number(item.amount);
|
1357
|
+
}, 0);
|
1358
|
+
const paidAmountWithoutSurcharge = paymentData.reduce((total, item) => {
|
1359
|
+
var _a2;
|
1360
|
+
return total + Number(item.amount) - Number(((_a2 = item.service_charge) == null ? void 0 : _a2.amount) || 0);
|
1361
|
+
}, 0);
|
1362
|
+
console.log("paidAmount>>>>", paidAmount, paidAmountWithoutSurcharge);
|
1363
|
+
checkout.updateVoucherPaymentItemsAsync([]);
|
1364
|
+
setEditCartMode == null ? void 0 : setEditCartMode(orderId, { paidAmount, paidAmountWithoutSurcharge }, closeModal);
|
1365
|
+
};
|
1304
1366
|
const CustomHeader = () => /* @__PURE__ */ import_react.default.createElement("div", { className: "payment-modal-custom-header" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "header__left" }, /* @__PURE__ */ import_react.default.createElement(
|
1305
1367
|
import_antd.Button,
|
1306
1368
|
{
|
@@ -1310,7 +1372,7 @@ var PaymentModal = ({
|
|
1310
1372
|
onClick: () => {
|
1311
1373
|
const checkout = pisellos.getModule("checkout");
|
1312
1374
|
if (checkout.isCurrentOrderSynced()) {
|
1313
|
-
|
1375
|
+
handleSetEditCartMode(true);
|
1314
1376
|
} else {
|
1315
1377
|
handlePaymentCancel(false);
|
1316
1378
|
}
|
@@ -1336,7 +1398,7 @@ var PaymentModal = ({
|
|
1336
1398
|
const unsubscribeRef = (0, import_react.useRef)(void 0);
|
1337
1399
|
(0, import_react.useEffect)(() => {
|
1338
1400
|
const initCheckoutData = async () => {
|
1339
|
-
var _a2, _b2;
|
1401
|
+
var _a2, _b2, _c2, _d2;
|
1340
1402
|
try {
|
1341
1403
|
const checkout = pisellos == null ? void 0 : pisellos.getModule("checkout");
|
1342
1404
|
if (checkout && data && !isLocalOrderCreated.current) {
|
@@ -1355,13 +1417,24 @@ var PaymentModal = ({
|
|
1355
1417
|
shop_wallet_pass_id
|
1356
1418
|
});
|
1357
1419
|
const newData = (0, import_lodash.cloneDeep)(data);
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1420
|
+
if (editOrderId || currentEditOrderId) {
|
1421
|
+
await checkout.updateLocalOrderAsync({
|
1422
|
+
orderId: editOrderId || currentEditOrderId,
|
1423
|
+
orderData: newData.order_info,
|
1424
|
+
cartSummary: (_a2 = newData.subtotal_info) == null ? void 0 : _a2.subTotalList,
|
1425
|
+
autoPayment: true,
|
1426
|
+
totalInfo: newData.subtotal_info
|
1427
|
+
});
|
1428
|
+
} else {
|
1429
|
+
await checkout.createLocalOrderAsync({
|
1430
|
+
orderData: newData.order_info,
|
1431
|
+
cartSummary: (_b2 = newData.subtotal_info) == null ? void 0 : _b2.subTotalList,
|
1432
|
+
autoPayment: true,
|
1433
|
+
totalInfo: newData.subtotal_info
|
1434
|
+
});
|
1435
|
+
}
|
1364
1436
|
const orderInfo2 = checkout.getCurrentOrderInfo();
|
1437
|
+
console.log(orderInfo2);
|
1365
1438
|
if (orderInfo2 && orderInfo2.totalAmount) {
|
1366
1439
|
setTotalAmount(orderInfo2.totalAmount);
|
1367
1440
|
}
|
@@ -1378,7 +1451,9 @@ var PaymentModal = ({
|
|
1378
1451
|
unsubscribeRef.current = checkout.core.effects.on(
|
1379
1452
|
"checkout:onOrderSynced",
|
1380
1453
|
async (data2) => {
|
1381
|
-
var _a3, _b3,
|
1454
|
+
var _a3, _b3, _c3, _d3, _e2;
|
1455
|
+
const currentOrderId = checkout.getCurrentOrderId();
|
1456
|
+
setCurrentEditOrderId(currentOrderId);
|
1382
1457
|
const responseData = (_a3 = data2.response) == null ? void 0 : _a3.data;
|
1383
1458
|
const paymentStatus = responseData == null ? void 0 : responseData.payment_status;
|
1384
1459
|
if (data2.isManual) return;
|
@@ -1389,7 +1464,7 @@ var PaymentModal = ({
|
|
1389
1464
|
const orderTotalAmount = Number((responseData == null ? void 0 : responseData.total_amount) || 0);
|
1390
1465
|
const gapAmount = Number((responseData == null ? void 0 : responseData.amount_gap) || 0);
|
1391
1466
|
const currentChangeGivenAmount = Number(
|
1392
|
-
(
|
1467
|
+
(_b3 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _b3.current_change_given_amount
|
1393
1468
|
);
|
1394
1469
|
const failureReason = responseData == null ? void 0 : responseData.failure_reason;
|
1395
1470
|
if (paymentStatus) {
|
@@ -1408,7 +1483,7 @@ var PaymentModal = ({
|
|
1408
1483
|
data: {
|
1409
1484
|
order_id: responseData.order_id,
|
1410
1485
|
machine_code_print_info: responseData == null ? void 0 : responseData.machine_code_print_info,
|
1411
|
-
small_ticket_data: (
|
1486
|
+
small_ticket_data: (_c3 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _c3.small_ticket_data,
|
1412
1487
|
machine_code_print_info_v2: responseData == null ? void 0 : responseData.machine_code_print_info_v2
|
1413
1488
|
}
|
1414
1489
|
};
|
@@ -1445,14 +1520,15 @@ var PaymentModal = ({
|
|
1445
1520
|
paymentStatus,
|
1446
1521
|
!!currentChangeGivenAmount
|
1447
1522
|
);
|
1448
|
-
const enabledAutoPrint = await ((_e2 = (
|
1523
|
+
const enabledAutoPrint = await ((_e2 = (_d3 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _d3.asyncDataManager) == null ? void 0 : _e2.call(_d3, {
|
1449
1524
|
module: "get",
|
1450
1525
|
key: "auto_print_receipt"
|
1451
1526
|
}));
|
1527
|
+
const orderInfo3 = checkout.getCurrentOrderInfo();
|
1452
1528
|
await (0, import_PaymentResultToastUtils.displayPaymentResultToast)(
|
1453
1529
|
{
|
1454
1530
|
paymentStatus,
|
1455
|
-
orderTotalAmount,
|
1531
|
+
orderTotalAmount: orderInfo3.isDeposit ? orderInfo3.depositAmount : orderTotalAmount,
|
1456
1532
|
gapAmount: paymentStatus === "partially_paid" ? gapAmount : currentChangeGivenAmount,
|
1457
1533
|
failureReason,
|
1458
1534
|
autoCloseConfig,
|
@@ -1484,12 +1560,22 @@ var PaymentModal = ({
|
|
1484
1560
|
);
|
1485
1561
|
isLocalOrderCreated.current = false;
|
1486
1562
|
await checkout.cancelCurrentOrderAsync();
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1563
|
+
if (editOrderId || currentEditOrderId) {
|
1564
|
+
await checkout.updateLocalOrderAsync({
|
1565
|
+
orderId: editOrderId || currentEditOrderId,
|
1566
|
+
orderData: data == null ? void 0 : data.order_info,
|
1567
|
+
cartSummary: (_c2 = data == null ? void 0 : data.subtotal_info) == null ? void 0 : _c2.subTotalList,
|
1568
|
+
autoPayment: true,
|
1569
|
+
totalInfo: data == null ? void 0 : data.subtotal_info
|
1570
|
+
});
|
1571
|
+
} else {
|
1572
|
+
await checkout.createLocalOrderAsync({
|
1573
|
+
orderData: data == null ? void 0 : data.order_info,
|
1574
|
+
cartSummary: (_d2 = data == null ? void 0 : data.subtotal_info) == null ? void 0 : _d2.subTotalList,
|
1575
|
+
autoPayment: true,
|
1576
|
+
totalInfo: data == null ? void 0 : data.subtotal_info
|
1577
|
+
});
|
1578
|
+
}
|
1493
1579
|
const orderInfo2 = checkout.getCurrentOrderInfo();
|
1494
1580
|
if (orderInfo2 && orderInfo2.totalAmount) {
|
1495
1581
|
setTotalAmount(orderInfo2.totalAmount);
|
@@ -1649,6 +1735,17 @@ var PaymentModal = ({
|
|
1649
1735
|
}
|
1650
1736
|
),
|
1651
1737
|
onClick: handleOrderNoteClick
|
1738
|
+
},
|
1739
|
+
enabledAutoPrint ? {
|
1740
|
+
key: "print",
|
1741
|
+
label: import_utils.locales.getText("payment.result.printReceipt"),
|
1742
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icon.Printer, { className: getClassName("action-icon") }),
|
1743
|
+
onClick: handlePrintReceiptClick
|
1744
|
+
} : {
|
1745
|
+
key: "details",
|
1746
|
+
label: import_utils.locales.getText("payment.result.details"),
|
1747
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icon.FileCheck02, { className: getClassName("action-icon") }),
|
1748
|
+
onClick: handleDetailsClick
|
1652
1749
|
}
|
1653
1750
|
],
|
1654
1751
|
buttonProps: {
|
@@ -1661,7 +1758,7 @@ var PaymentModal = ({
|
|
1661
1758
|
case "partially_paid":
|
1662
1759
|
return [
|
1663
1760
|
[
|
1664
|
-
{
|
1761
|
+
enabledAutoPrint ? {
|
1665
1762
|
id: "details",
|
1666
1763
|
buttonProps: {
|
1667
1764
|
className: getClassName("action-button"),
|
@@ -1669,6 +1766,14 @@ var PaymentModal = ({
|
|
1669
1766
|
icon: /* @__PURE__ */ import_react.default.createElement(import_icon.FileCheck02, { className: getClassName("action-icon") }),
|
1670
1767
|
children: import_utils.locales.getText("payment.result.details")
|
1671
1768
|
}
|
1769
|
+
} : {
|
1770
|
+
id: "print",
|
1771
|
+
buttonProps: {
|
1772
|
+
className: getClassName("action-button"),
|
1773
|
+
onClick: handlePrintReceiptClick,
|
1774
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icon.Printer, { className: getClassName("action-icon") }),
|
1775
|
+
children: import_utils.locales.getText("payment.result.printReceipt")
|
1776
|
+
}
|
1672
1777
|
},
|
1673
1778
|
{
|
1674
1779
|
id: "more",
|
@@ -1684,6 +1789,17 @@ var PaymentModal = ({
|
|
1684
1789
|
}
|
1685
1790
|
),
|
1686
1791
|
onClick: handleOrderNoteClick
|
1792
|
+
},
|
1793
|
+
enabledAutoPrint ? {
|
1794
|
+
key: "print",
|
1795
|
+
label: import_utils.locales.getText("payment.result.printReceipt"),
|
1796
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icon.Printer, { className: getClassName("action-icon") }),
|
1797
|
+
onClick: handlePrintReceiptClick
|
1798
|
+
} : {
|
1799
|
+
key: "details",
|
1800
|
+
label: import_utils.locales.getText("payment.result.details"),
|
1801
|
+
icon: /* @__PURE__ */ import_react.default.createElement(import_icon.FileCheck02, { className: getClassName("action-icon") }),
|
1802
|
+
onClick: handleDetailsClick
|
1687
1803
|
}
|
1688
1804
|
],
|
1689
1805
|
buttonProps: {
|
@@ -1865,7 +1981,9 @@ var PaymentModal = ({
|
|
1865
1981
|
dynamicMaxHeight,
|
1866
1982
|
onOrderSyncFailed: () => setShowRetryModal(true),
|
1867
1983
|
generateActionButtons,
|
1868
|
-
paymentResultToastConfig
|
1984
|
+
paymentResultToastConfig,
|
1985
|
+
updateOrderInfo: (orderInfo2) => setOrderInfo(orderInfo2),
|
1986
|
+
setCurrentEditOrderId: (orderId) => setCurrentEditOrderId(orderId)
|
1869
1987
|
}
|
1870
1988
|
)
|
1871
1989
|
), noteModalOpen && (0, import_react_dom.createPortal)(
|
@@ -1889,10 +2007,9 @@ var PaymentModal = ({
|
|
1889
2007
|
open: showRetryModal,
|
1890
2008
|
title: import_utils.locales.getText("pisell2.checkout.tips"),
|
1891
2009
|
footer: null,
|
1892
|
-
closable: false,
|
1893
|
-
maskClosable: false,
|
1894
2010
|
keyboard: false,
|
1895
2011
|
onCancel: () => {
|
2012
|
+
setShowRetryModal(false);
|
1896
2013
|
}
|
1897
2014
|
// 禁用关闭
|
1898
2015
|
}
|