@pisell/private-materials 6.5.10 → 6.5.12
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 +2 -2
- package/build/lowcode/preview.js +148 -164
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +7 -7
- package/es/components/Sales/Summary/utils.d.ts +1 -1
- package/es/components/appointmentBooking/components/Services/index.js +36 -18
- package/es/components/appointmentBooking/hooks.js +6 -0
- package/es/components/booking/components/footer/index.js +24 -5
- package/es/components/booking/editBookingModal/index.js +8 -2
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
- package/es/components/booking/info/service2/utils.d.ts +1 -1
- package/es/components/booking/locales.d.ts +6 -0
- package/es/components/booking/locales.js +12 -0
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/checkout/PaymentModal.js +145 -101
- package/es/components/checkout/components/AmountSummary/index.js +6 -4
- package/es/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
- package/es/components/checkout/components/CashPaymentModule/index.js +14 -10
- package/es/components/checkout/components/PaymentDetailModal/index.js +76 -27
- package/es/components/checkout/components/PaymentDetailModal/index.less +23 -2
- package/es/components/checkout/components/PaymentOptionsModule/index.js +4 -1
- package/es/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/es/components/checkout/hooks/useWalletPass.js +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/linkly/hooks/normal.js +3 -3
- package/es/components/eftposPay/linkly/hooks/useTimeQuery.js +60 -17
- package/es/components/eftposPay/payo/config.js +10 -10
- package/es/components/eftposPay/serve.js +1 -1
- package/es/components/eftposPay/store/index.d.ts +3 -3
- package/es/components/index.d.ts +3 -1
- package/es/components/index.js +3 -1
- package/es/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +6 -3
- package/es/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/index.js +112 -24
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
- package/es/components/pay/toC/PaymentMethods/WalletPass/serve.js +78 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
- package/es/components/pay/toC/PaymentMethods/WalletPass/utils.js +9 -0
- package/es/components/pay/toC/utils.js +1 -1
- package/es/components/pinModal/hooks.d.ts +7 -0
- package/es/components/pinModal/hooks.js +65 -0
- package/es/components/pinModal/index.d.ts +4 -0
- package/es/components/pinModal/index.js +98 -0
- package/es/components/pinModal/index.less +44 -0
- package/es/components/pinModal/locales.d.ts +27 -0
- package/es/components/pinModal/locales.js +26 -0
- package/es/components/pinModal/serve.d.ts +6 -0
- package/es/components/pinModal/serve.js +11 -0
- package/es/components/pinModal/types.d.ts +0 -0
- package/es/components/pinModal/types.js +0 -0
- package/es/components/pinVerifyModal/hooks.d.ts +7 -0
- package/es/components/pinVerifyModal/hooks.js +80 -0
- package/es/components/pinVerifyModal/index.d.ts +5 -0
- package/es/components/pinVerifyModal/index.js +218 -0
- package/es/components/pinVerifyModal/index.less +92 -0
- package/es/components/pinVerifyModal/locales.d.ts +24 -0
- package/es/components/pinVerifyModal/locales.js +23 -0
- package/es/components/pinVerifyModal/types.d.ts +33 -0
- package/es/components/pinVerifyModal/types.js +1 -0
- package/es/components/schedules/utils.d.ts +1 -1
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +7 -0
- package/es/components/ticketBooking/components/ticketBooking/index.js +56 -10
- package/es/components/ticketBooking/components/timeBar/index.js +2 -1
- package/es/components/ticketBooking/utils/index.d.ts +1 -1
- package/es/components/walletList/index.js +20 -2
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/es/utils/index.d.ts +1 -1
- package/lib/components/Sales/Summary/utils.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Services/index.js +13 -3
- package/lib/components/appointmentBooking/hooks.js +6 -0
- package/lib/components/booking/components/footer/index.js +21 -3
- package/lib/components/booking/editBookingModal/index.js +6 -1
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -1
- package/lib/components/booking/info/service2/utils.d.ts +1 -1
- package/lib/components/booking/locales.d.ts +6 -0
- package/lib/components/booking/locales.js +6 -0
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/checkout/PaymentModal.js +37 -9
- package/lib/components/checkout/components/AmountSummary/index.js +4 -4
- package/lib/components/checkout/components/CashPaymentModule/index.d.ts +3 -1
- package/lib/components/checkout/components/CashPaymentModule/index.js +6 -3
- package/lib/components/checkout/components/PaymentDetailModal/index.js +47 -14
- package/lib/components/checkout/components/PaymentDetailModal/index.less +23 -2
- package/lib/components/checkout/components/PaymentOptionsModule/index.js +3 -1
- package/lib/components/checkout/hooks/useWalletPass.d.ts +1 -1
- package/lib/components/checkout/hooks/useWalletPass.js +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/linkly/hooks/normal.js +3 -3
- package/lib/components/eftposPay/linkly/hooks/useTimeQuery.js +59 -15
- package/lib/components/eftposPay/payo/config.js +9 -9
- package/lib/components/eftposPay/serve.js +1 -1
- package/lib/components/eftposPay/store/index.d.ts +3 -3
- package/lib/components/index.d.ts +3 -1
- package/lib/components/index.js +6 -0
- package/lib/components/pay/toC/PaymentMethods/MWCreditCard/tds2.js +2 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/List/index.d.ts +2 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/index.js +84 -36
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.d.ts +38 -2
- package/lib/components/pay/toC/PaymentMethods/WalletPass/serve.js +18 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.d.ts +6 -0
- package/lib/components/pay/toC/PaymentMethods/WalletPass/utils.js +7 -2
- package/lib/components/pay/toC/utils.js +1 -1
- package/lib/components/pinModal/hooks.d.ts +7 -0
- package/lib/components/pinModal/hooks.js +85 -0
- package/lib/components/pinModal/index.d.ts +4 -0
- package/lib/components/pinModal/index.js +88 -0
- package/lib/components/pinModal/index.less +44 -0
- package/lib/components/pinModal/locales.d.ts +27 -0
- package/lib/components/pinModal/locales.js +50 -0
- package/lib/components/pinModal/serve.d.ts +6 -0
- package/lib/components/pinModal/serve.js +37 -0
- package/lib/components/pinModal/types.d.ts +0 -0
- package/lib/components/pinModal/types.js +0 -0
- package/lib/components/pinVerifyModal/hooks.d.ts +7 -0
- package/lib/components/pinVerifyModal/hooks.js +93 -0
- package/lib/components/pinVerifyModal/index.d.ts +5 -0
- package/lib/components/pinVerifyModal/index.js +230 -0
- package/lib/components/pinVerifyModal/index.less +92 -0
- package/lib/components/pinVerifyModal/locales.d.ts +24 -0
- package/lib/components/pinVerifyModal/locales.js +47 -0
- package/lib/components/pinVerifyModal/types.d.ts +33 -0
- package/lib/components/pinVerifyModal/types.js +17 -0
- package/lib/components/schedules/utils.d.ts +1 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +7 -0
- package/lib/components/ticketBooking/components/ticketBooking/index.js +52 -5
- package/lib/components/ticketBooking/components/timeBar/index.js +2 -1
- package/lib/components/ticketBooking/utils/index.d.ts +1 -1
- package/lib/components/walletList/index.js +19 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lib/utils/index.d.ts +1 -1
- package/lowcode/pin-modal/meta.ts +37 -0
- package/lowcode/pin-verify-modal/meta.ts +80 -0
- package/package.json +1 -1
@@ -113,41 +113,46 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
113
113
|
_useState4 = _slicedToArray(_useState3, 2),
|
114
114
|
balanceDueAmount = _useState4[0],
|
115
115
|
setBalanceDueAmount = _useState4[1];
|
116
|
-
|
116
|
+
// 剩余待付金额-跟定金无关的一个订单总体待付金额,上面这个 balanceDueAmount 是会收到订单影响的,下面这个不会
|
117
|
+
var _useState5 = useState(''),
|
117
118
|
_useState6 = _slicedToArray(_useState5, 2),
|
118
|
-
|
119
|
-
|
120
|
-
var paymentMethodsRef = useRef(null);
|
119
|
+
balanceDueTotalAmount = _useState6[0],
|
120
|
+
setBalanceDueTotalAmount = _useState6[1];
|
121
121
|
var _useState7 = useState([]),
|
122
122
|
_useState8 = _slicedToArray(_useState7, 2),
|
123
|
-
|
124
|
-
|
125
|
-
var
|
123
|
+
recommendAmounts = _useState8[0],
|
124
|
+
setRecommendAmounts = _useState8[1];
|
125
|
+
var paymentMethodsRef = useRef(null);
|
126
|
+
var _useState9 = useState([]),
|
126
127
|
_useState10 = _slicedToArray(_useState9, 2),
|
127
|
-
|
128
|
-
|
129
|
-
var _useState11 = useState(
|
128
|
+
paymentMethods = _useState10[0],
|
129
|
+
setPaymentMethods = _useState10[1];
|
130
|
+
var _useState11 = useState(false),
|
130
131
|
_useState12 = _slicedToArray(_useState11, 2),
|
131
|
-
|
132
|
-
|
132
|
+
showCashPayment = _useState12[0],
|
133
|
+
setShowCashPayment = _useState12[1];
|
134
|
+
var _useState13 = useState(locales.getText('cards.and.digitals') || 'Cards & Digitals'),
|
135
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
136
|
+
paymentOptionsTitle = _useState14[0],
|
137
|
+
setPaymentOptionsTitle = _useState14[1];
|
133
138
|
var clientChangedRef = useRef(false);
|
134
139
|
var walletPassRef = useRef(null);
|
135
140
|
// 已保存的支付项数据
|
136
|
-
var
|
137
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
138
|
-
paymentItems = _useState14[0],
|
139
|
-
setPaymentItems = _useState14[1];
|
140
|
-
// 钱包卡券数据
|
141
|
-
var _useState15 = useState({}),
|
141
|
+
var _useState15 = useState([]),
|
142
142
|
_useState16 = _slicedToArray(_useState15, 2),
|
143
|
-
|
144
|
-
|
143
|
+
paymentItems = _useState16[0],
|
144
|
+
setPaymentItems = _useState16[1];
|
145
|
+
// 钱包卡券数据
|
146
|
+
var _useState17 = useState({}),
|
147
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
148
|
+
walletPassData = _useState18[0],
|
149
|
+
setWalletPassData = _useState18[1];
|
145
150
|
var _usePrinter = usePrinter(),
|
146
151
|
nativePrint = _usePrinter.nativePrint;
|
147
|
-
var
|
148
|
-
|
149
|
-
syncingLock =
|
150
|
-
setSyncingLock =
|
152
|
+
var _useState19 = useState(false),
|
153
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
154
|
+
syncingLock = _useState20[0],
|
155
|
+
setSyncingLock = _useState20[1];
|
151
156
|
var isOrderFree = useMemo(function () {
|
152
157
|
if (!customAmount) return false;
|
153
158
|
var amount = parseFloat(customAmount);
|
@@ -155,14 +160,14 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
155
160
|
}, [customAmount]);
|
156
161
|
|
157
162
|
// 新增状态:订单备注和手动折扣
|
158
|
-
var _useState19 = useState(false),
|
159
|
-
_useState20 = _slicedToArray(_useState19, 2),
|
160
|
-
paymentLinkModalOpen = _useState20[0],
|
161
|
-
setPaymentLinkModalOpen = _useState20[1];
|
162
163
|
var _useState21 = useState(false),
|
163
164
|
_useState22 = _slicedToArray(_useState21, 2),
|
164
|
-
|
165
|
-
|
165
|
+
paymentLinkModalOpen = _useState22[0],
|
166
|
+
setPaymentLinkModalOpen = _useState22[1];
|
167
|
+
var _useState23 = useState(false),
|
168
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
169
|
+
showPriceAdjustModal = _useState24[0],
|
170
|
+
setShowPriceAdjustModal = _useState24[1];
|
166
171
|
var logger = usePaymentLogger();
|
167
172
|
var currency = getData('shop_currency_code') || 'USD';
|
168
173
|
|
@@ -418,6 +423,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
418
423
|
var _cartData$order_info;
|
419
424
|
setCustomAmount(currentAmount);
|
420
425
|
setBalanceDueAmount(currentAmount);
|
426
|
+
setBalanceDueTotalAmount(orderInfo.totalAmount || '0');
|
421
427
|
// 设置订单备注默认值 - 优先从 checkoutModule 获取,如果没有则从购物车数据获取
|
422
428
|
var currentNote = checkoutModule.getOrderNote();
|
423
429
|
if (currentNote) {
|
@@ -520,6 +526,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
520
526
|
}());
|
521
527
|
var amountChangedUnsubscribe = core.effects.on(CheckoutHooks.OnBalanceDueAmountChanged, function (data) {
|
522
528
|
setBalanceDueAmount(data.newAmount);
|
529
|
+
setBalanceDueTotalAmount(data.totalAmount || '0');
|
523
530
|
});
|
524
531
|
var orderSubmitStartUnsubscribe = core.effects.on(CheckoutHooks.OnOrderSubmitStart, function () {
|
525
532
|
var _Toast$loading;
|
@@ -563,7 +570,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
563
570
|
updateOrderInfo === null || updateOrderInfo === void 0 || updateOrderInfo(orderInfo);
|
564
571
|
balanceDueAmount = checkoutModule.getBalanceDueAmount();
|
565
572
|
if (!(Number(balanceDueAmount) > 0)) {
|
566
|
-
_context5.next =
|
573
|
+
_context5.next = 14;
|
567
574
|
break;
|
568
575
|
}
|
569
576
|
autoCloseConfig = calculateAutoCloseConfig('partially_paid', false); // 获取订单总金额
|
@@ -575,7 +582,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
575
582
|
if (_paymentItems.length > 0 && _paymentItems.filter(function (n) {
|
576
583
|
return n.isSynced;
|
577
584
|
}).some(function (item) {
|
578
|
-
return item.service_charge;
|
585
|
+
return item.service_charge || item.rounding_amount;
|
579
586
|
})) {
|
580
587
|
serviceChargeTotal = _paymentItems.reduce(function (acc, item) {
|
581
588
|
var _item$service_charge, _item$service_charge2;
|
@@ -583,13 +590,19 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
583
590
|
var chargePercentage = new Decimal(((_item$service_charge2 = item.service_charge) === null || _item$service_charge2 === void 0 ? void 0 : _item$service_charge2.percentage) || 0);
|
584
591
|
var itemAmount = new Decimal(item.amount || 0);
|
585
592
|
var itemServiceCharge = chargeAmount.add(chargePercentage.mul(itemAmount));
|
593
|
+
// 如果支付项的 rounding_amount 是正数,需要减掉rounding_amount
|
594
|
+
// if (Number(item.rounding_amount) > 0) {
|
595
|
+
// itemServiceCharge = itemServiceCharge.sub(new Decimal(item.rounding_amount));
|
596
|
+
// }
|
597
|
+
console.log(itemServiceCharge);
|
586
598
|
return acc.add(itemServiceCharge);
|
587
599
|
}, new Decimal(0));
|
588
600
|
_totalAmount = _totalAmount.add(serviceChargeTotal);
|
589
601
|
}
|
602
|
+
console.log(_totalAmount, _paymentItems);
|
590
603
|
|
591
604
|
// 根据支付状态展示不同的 toast
|
592
|
-
_context5.next =
|
605
|
+
_context5.next = 14;
|
593
606
|
return displayPaymentResultToast({
|
594
607
|
paymentStatus: 'partially_paid',
|
595
608
|
orderTotalAmount: _totalAmount.toNumber(),
|
@@ -607,7 +620,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
607
620
|
// 不自动关闭Modal,让两个弹窗独立管理
|
608
621
|
}
|
609
622
|
}));
|
610
|
-
case
|
623
|
+
case 14:
|
611
624
|
// 判断是否为现金支付
|
612
625
|
paymentMethodName = data.paymentMethodName || data.name || '';
|
613
626
|
isCashPayment = data.paymentMethodCode === 'CASHMANUAL' || /现金|現金/i.test(paymentMethodName) || /cash/i.test(paymentMethodName);
|
@@ -626,7 +639,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
626
639
|
}
|
627
640
|
});
|
628
641
|
}
|
629
|
-
case
|
642
|
+
case 17:
|
630
643
|
case "end":
|
631
644
|
return _context5.stop();
|
632
645
|
}
|
@@ -757,19 +770,23 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
757
770
|
return showSuccessToast === null || showSuccessToast === void 0 ? void 0 : showSuccessToast(result);
|
758
771
|
case 12:
|
759
772
|
if (!result.success) {
|
760
|
-
_context8.next =
|
773
|
+
_context8.next = 23;
|
761
774
|
break;
|
762
775
|
}
|
776
|
+
// 触发 voucher 的更新
|
777
|
+
checkoutModule.core.effects.emit('checkout:onPaymentStarted', {
|
778
|
+
paymentMethodCode: ''
|
779
|
+
});
|
763
780
|
// 检查订单此时是不是定金支付订单
|
764
781
|
_orderInfo = checkoutModule.getCurrentOrderInfo();
|
765
782
|
setCurrentEditOrderId === null || setCurrentEditOrderId === void 0 || setCurrentEditOrderId(result.orderId);
|
766
783
|
if (!(result.is_deposit && Number(_orderInfo.depositAmount) < Number(_orderInfo.totalAmount))) {
|
767
|
-
_context8.next =
|
784
|
+
_context8.next = 19;
|
768
785
|
break;
|
769
786
|
}
|
770
787
|
updateOrderInfo === null || updateOrderInfo === void 0 || updateOrderInfo(_orderInfo);
|
771
788
|
return _context8.abrupt("return");
|
772
|
-
case
|
789
|
+
case 19:
|
773
790
|
responseData = (_result$response = result.response) === null || _result$response === void 0 ? void 0 : _result$response.data; // 打印订单完整信息
|
774
791
|
console.log('print_order_onOrderSynced>>>>', result);
|
775
792
|
try {
|
@@ -792,7 +809,7 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
792
809
|
}
|
793
810
|
// 支付成功时关闭 PaymentModal
|
794
811
|
onPaymentCancel(true);
|
795
|
-
case
|
812
|
+
case 23:
|
796
813
|
case "end":
|
797
814
|
return _context8.stop();
|
798
815
|
}
|
@@ -1284,7 +1301,8 @@ var PaymentContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
1284
1301
|
amountButtons: recommendAmounts,
|
1285
1302
|
customAmount: customAmount,
|
1286
1303
|
roundingFunction: roundingFunction,
|
1287
|
-
balanceDueAmount: balanceDueAmount
|
1304
|
+
balanceDueAmount: balanceDueAmount,
|
1305
|
+
balanceDueTotalAmount: balanceDueTotalAmount
|
1288
1306
|
})), moduleConfig.showPaymentOptions && /*#__PURE__*/React.createElement("div", {
|
1289
1307
|
className: showCashPayment ? '' : 'payment-options-module-container',
|
1290
1308
|
style: showCashPayment ? {
|
@@ -1364,31 +1382,32 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1364
1382
|
var _ref19 = (context === null || context === void 0 || (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
1365
1383
|
pisellos = _ref19.pisellos,
|
1366
1384
|
getData = _ref19.getData,
|
1367
|
-
interaction = _ref19.interaction
|
1368
|
-
|
1369
|
-
|
1370
|
-
orderInfo = _useState24[0],
|
1371
|
-
setOrderInfo = _useState24[1];
|
1372
|
-
var _useState25 = useState(0),
|
1385
|
+
interaction = _ref19.interaction,
|
1386
|
+
isWebPos = _ref19.isWebPos;
|
1387
|
+
var _useState25 = useState(null),
|
1373
1388
|
_useState26 = _slicedToArray(_useState25, 2),
|
1374
|
-
|
1375
|
-
|
1376
|
-
var _useState27 = useState(
|
1389
|
+
orderInfo = _useState26[0],
|
1390
|
+
setOrderInfo = _useState26[1];
|
1391
|
+
var _useState27 = useState(0),
|
1377
1392
|
_useState28 = _slicedToArray(_useState27, 2),
|
1378
|
-
|
1379
|
-
|
1380
|
-
var _useState29 = useState(
|
1393
|
+
totalAmount = _useState28[0],
|
1394
|
+
setTotalAmount = _useState28[1];
|
1395
|
+
var _useState29 = useState(true),
|
1381
1396
|
_useState30 = _slicedToArray(_useState29, 2),
|
1382
|
-
|
1383
|
-
|
1384
|
-
var _useState31 = useState(
|
1397
|
+
actualShowCashPayment = _useState30[0],
|
1398
|
+
setActualShowCashPayment = _useState30[1];
|
1399
|
+
var _useState31 = useState(0),
|
1385
1400
|
_useState32 = _slicedToArray(_useState31, 2),
|
1386
|
-
|
1387
|
-
|
1388
|
-
var _useState33 = useState(
|
1401
|
+
windowHeight = _useState32[0],
|
1402
|
+
setWindowHeight = _useState32[1];
|
1403
|
+
var _useState33 = useState(false),
|
1389
1404
|
_useState34 = _slicedToArray(_useState33, 2),
|
1390
|
-
|
1391
|
-
|
1405
|
+
showRetryModal = _useState34[0],
|
1406
|
+
setShowRetryModal = _useState34[1];
|
1407
|
+
var _useState35 = useState(editOrderId || 0),
|
1408
|
+
_useState36 = _slicedToArray(_useState35, 2),
|
1409
|
+
currentEditOrderId = _useState36[0],
|
1410
|
+
_setCurrentEditOrderId = _useState36[1];
|
1392
1411
|
var Toast = useToast();
|
1393
1412
|
var _usePrinter2 = usePrinter(),
|
1394
1413
|
nativePrint = _usePrinter2.nativePrint;
|
@@ -1523,18 +1542,18 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1523
1542
|
}, []);
|
1524
1543
|
|
1525
1544
|
// 订单备注相关状态
|
1526
|
-
var
|
1527
|
-
_useState36 = _slicedToArray(_useState35, 2),
|
1528
|
-
noteModalOpen = _useState36[0],
|
1529
|
-
setNoteModalOpen = _useState36[1];
|
1530
|
-
var _useState37 = useState(''),
|
1545
|
+
var _useState37 = useState(false),
|
1531
1546
|
_useState38 = _slicedToArray(_useState37, 2),
|
1532
|
-
|
1533
|
-
|
1534
|
-
var _useState39 = useState('
|
1547
|
+
noteModalOpen = _useState38[0],
|
1548
|
+
setNoteModalOpen = _useState38[1];
|
1549
|
+
var _useState39 = useState(''),
|
1535
1550
|
_useState40 = _slicedToArray(_useState39, 2),
|
1536
|
-
|
1537
|
-
|
1551
|
+
orderNote = _useState40[0],
|
1552
|
+
setOrderNote = _useState40[1];
|
1553
|
+
var _useState41 = useState('payment-content'),
|
1554
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
1555
|
+
noteModalSource = _useState42[0],
|
1556
|
+
setNoteModalSource = _useState42[1];
|
1538
1557
|
|
1539
1558
|
// 订单备注相关处理函数
|
1540
1559
|
var handleNoteConfirm = /*#__PURE__*/function () {
|
@@ -1995,7 +2014,7 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
1995
2014
|
// 获取 checkout 模块并处理订单数据
|
1996
2015
|
checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
1997
2016
|
if (!(checkout && data && !isLocalOrderCreated.current)) {
|
1998
|
-
_context23.next =
|
2017
|
+
_context23.next = 25;
|
1999
2018
|
break;
|
2000
2019
|
}
|
2001
2020
|
isLocalOrderCreated.current = true;
|
@@ -2030,17 +2049,24 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2030
2049
|
totalInfo: newData.subtotal_info
|
2031
2050
|
});
|
2032
2051
|
case 12:
|
2033
|
-
_context23.next =
|
2052
|
+
_context23.next = 17;
|
2034
2053
|
break;
|
2035
2054
|
case 14:
|
2036
|
-
|
2055
|
+
logger === null || logger === void 0 || logger.addLog({
|
2056
|
+
type: 'info',
|
2057
|
+
title: '正常创建 createLocalOrderAsync',
|
2058
|
+
metadata: {
|
2059
|
+
data: data
|
2060
|
+
}
|
2061
|
+
});
|
2062
|
+
_context23.next = 17;
|
2037
2063
|
return checkout.createLocalOrderAsync({
|
2038
2064
|
orderData: newData.order_info,
|
2039
2065
|
cartSummary: (_newData$subtotal_inf2 = newData.subtotal_info) === null || _newData$subtotal_inf2 === void 0 ? void 0 : _newData$subtotal_inf2.subTotalList,
|
2040
2066
|
autoPayment: true,
|
2041
2067
|
totalInfo: newData.subtotal_info
|
2042
2068
|
});
|
2043
|
-
case
|
2069
|
+
case 17:
|
2044
2070
|
// 获取订单总金额
|
2045
2071
|
_orderInfo2 = checkout.getCurrentOrderInfo();
|
2046
2072
|
console.log(_orderInfo2);
|
@@ -2061,7 +2087,7 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2061
2087
|
unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', /*#__PURE__*/function () {
|
2062
2088
|
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(data) {
|
2063
2089
|
var _data$response, _responseData$payment2;
|
2064
|
-
var currentOrderId, responseData, paymentStatus, orderTotalAmount, gapAmount, currentChangeGivenAmount, failureReason,
|
2090
|
+
var currentOrderId, responseData, paymentStatus, orderTotalAmount, gapAmount, currentChangeGivenAmount, failureReason, _responseData$payment3, params, statusClassName, autoCloseConfig, enabledAutoPrint, _interaction$utils6, _interaction$utils6$a, _orderInfo3, paymentResult;
|
2065
2091
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
2066
2092
|
while (1) switch (_context22.prev = _context22.next) {
|
2067
2093
|
case 0:
|
@@ -2092,7 +2118,7 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2092
2118
|
// 获取失败原因
|
2093
2119
|
failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason; // 根据支付状态弹出对应的支付结果toast
|
2094
2120
|
if (!paymentStatus) {
|
2095
|
-
_context22.next =
|
2121
|
+
_context22.next = 35;
|
2096
2122
|
break;
|
2097
2123
|
}
|
2098
2124
|
// 打印订单完整信息
|
@@ -2147,15 +2173,26 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2147
2173
|
// 确定支付状态
|
2148
2174
|
statusClassName = calculateStatusClassName(paymentStatus);
|
2149
2175
|
autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
|
2150
|
-
|
2176
|
+
enabledAutoPrint = false;
|
2177
|
+
if (!isWebPos) {
|
2178
|
+
_context22.next = 24;
|
2179
|
+
break;
|
2180
|
+
}
|
2181
|
+
// web pos 没有自动打印配置
|
2182
|
+
enabledAutoPrint = false;
|
2183
|
+
_context22.next = 27;
|
2184
|
+
break;
|
2185
|
+
case 24:
|
2186
|
+
_context22.next = 26;
|
2151
2187
|
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, {
|
2152
2188
|
module: 'get',
|
2153
2189
|
key: 'auto_print_receipt'
|
2154
2190
|
});
|
2155
|
-
case
|
2191
|
+
case 26:
|
2156
2192
|
enabledAutoPrint = _context22.sent;
|
2193
|
+
case 27:
|
2157
2194
|
_orderInfo3 = checkout.getCurrentOrderInfo(); // 根据支付状态展示不同的 toast
|
2158
|
-
_context22.next =
|
2195
|
+
_context22.next = 30;
|
2159
2196
|
return displayPaymentResultToast({
|
2160
2197
|
paymentStatus: paymentStatus,
|
2161
2198
|
orderTotalAmount: _orderInfo3.isDeposit ? _orderInfo3.depositAmount : orderTotalAmount,
|
@@ -2164,7 +2201,7 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2164
2201
|
autoCloseConfig: autoCloseConfig,
|
2165
2202
|
actionButtons: generateActionButtons(paymentStatus, enabledAutoPrint)
|
2166
2203
|
}, paymentResultToastConfig);
|
2167
|
-
case
|
2204
|
+
case 30:
|
2168
2205
|
// 当支付状态为 paid 时,关闭 paymentModal
|
2169
2206
|
if (paymentStatus === 'paid') {
|
2170
2207
|
handleModalClose();
|
@@ -2180,11 +2217,11 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2180
2217
|
}
|
2181
2218
|
});
|
2182
2219
|
handlePaymentComplete(paymentResult);
|
2183
|
-
_context22.next =
|
2220
|
+
_context22.next = 36;
|
2184
2221
|
break;
|
2185
|
-
case
|
2222
|
+
case 35:
|
2186
2223
|
handlePaymentComplete(data);
|
2187
|
-
case
|
2224
|
+
case 36:
|
2188
2225
|
case "end":
|
2189
2226
|
return _context22.stop();
|
2190
2227
|
}
|
@@ -2194,24 +2231,24 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2194
2231
|
return _ref29.apply(this, arguments);
|
2195
2232
|
};
|
2196
2233
|
}());
|
2197
|
-
_context23.next =
|
2234
|
+
_context23.next = 42;
|
2198
2235
|
break;
|
2199
|
-
case
|
2236
|
+
case 25:
|
2200
2237
|
if (!isLocalOrderCreated.current) {
|
2201
|
-
_context23.next =
|
2238
|
+
_context23.next = 42;
|
2202
2239
|
break;
|
2203
2240
|
}
|
2204
2241
|
// // 如果本地订单已创建,这时候还更新了 data,则需要销毁当前的订单数据,然后更新新的订单数据了
|
2205
2242
|
console.log('🔄 PaymentModal: data changed, updating checkout data...');
|
2206
2243
|
isLocalOrderCreated.current = false;
|
2207
|
-
_context23.next =
|
2244
|
+
_context23.next = 30;
|
2208
2245
|
return checkout.cancelCurrentOrderAsync();
|
2209
|
-
case
|
2246
|
+
case 30:
|
2210
2247
|
if (!(editOrderId || currentEditOrderId)) {
|
2211
|
-
_context23.next =
|
2248
|
+
_context23.next = 35;
|
2212
2249
|
break;
|
2213
2250
|
}
|
2214
|
-
_context23.next =
|
2251
|
+
_context23.next = 33;
|
2215
2252
|
return checkout.updateLocalOrderAsync({
|
2216
2253
|
orderId: editOrderId || currentEditOrderId,
|
2217
2254
|
orderData: data === null || data === void 0 ? void 0 : data.order_info,
|
@@ -2219,18 +2256,25 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2219
2256
|
autoPayment: true,
|
2220
2257
|
totalInfo: data === null || data === void 0 ? void 0 : data.subtotal_info
|
2221
2258
|
});
|
2222
|
-
case
|
2223
|
-
_context23.next =
|
2259
|
+
case 33:
|
2260
|
+
_context23.next = 38;
|
2224
2261
|
break;
|
2225
|
-
case
|
2226
|
-
|
2262
|
+
case 35:
|
2263
|
+
logger === null || logger === void 0 || logger.addLog({
|
2264
|
+
type: 'info',
|
2265
|
+
title: '含有 localOrderCreate, 调用 createLocalOrderAsync',
|
2266
|
+
metadata: {
|
2267
|
+
data: data
|
2268
|
+
}
|
2269
|
+
});
|
2270
|
+
_context23.next = 38;
|
2227
2271
|
return checkout.createLocalOrderAsync({
|
2228
2272
|
orderData: data === null || data === void 0 ? void 0 : data.order_info,
|
2229
2273
|
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
2274
|
autoPayment: true,
|
2231
2275
|
totalInfo: data === null || data === void 0 ? void 0 : data.subtotal_info
|
2232
2276
|
});
|
2233
|
-
case
|
2277
|
+
case 38:
|
2234
2278
|
// 获取订单总金额
|
2235
2279
|
_orderInfo4 = checkout.getCurrentOrderInfo();
|
2236
2280
|
if (_orderInfo4 && _orderInfo4.totalAmount) {
|
@@ -2238,11 +2282,11 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2238
2282
|
}
|
2239
2283
|
setOrderInfo(_orderInfo4);
|
2240
2284
|
isLocalOrderCreated.current = true;
|
2241
|
-
case 40:
|
2242
|
-
_context23.next = 46;
|
2243
|
-
break;
|
2244
2285
|
case 42:
|
2245
|
-
_context23.
|
2286
|
+
_context23.next = 48;
|
2287
|
+
break;
|
2288
|
+
case 44:
|
2289
|
+
_context23.prev = 44;
|
2246
2290
|
_context23.t0 = _context23["catch"](0);
|
2247
2291
|
console.error('Failed to initialize checkout data:', _context23.t0);
|
2248
2292
|
logger === null || logger === void 0 || logger.addLog({
|
@@ -2252,11 +2296,11 @@ var PaymentModal = function PaymentModal(_ref18) {
|
|
2252
2296
|
error: _context23.t0
|
2253
2297
|
}
|
2254
2298
|
});
|
2255
|
-
case
|
2299
|
+
case 48:
|
2256
2300
|
case "end":
|
2257
2301
|
return _context23.stop();
|
2258
2302
|
}
|
2259
|
-
}, _callee23, null, [[0,
|
2303
|
+
}, _callee23, null, [[0, 44]]);
|
2260
2304
|
}));
|
2261
2305
|
return function initCheckoutData() {
|
2262
2306
|
return _ref28.apply(this, arguments);
|
@@ -501,8 +501,10 @@ function AmountSummary(_ref2) {
|
|
501
501
|
|
502
502
|
// 需要减去已经同步给后端过的 voucher
|
503
503
|
var syncedVoucherAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
504
|
-
|
505
|
-
|
504
|
+
// 如果当前是普通支付,则减去order_payment_type不为 deposit的支付项
|
505
|
+
// 如果当前是定金支付,则减去order_payment_type为 deposit的支付项
|
506
|
+
if (item.isSynced && (paymentType === 'regular' && item.order_payment_type !== 'deposit' || paymentType === 'deposit' && item.order_payment_type === 'deposit')) {
|
507
|
+
return acc.plus(item.amount).plus(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0);
|
506
508
|
}
|
507
509
|
return acc;
|
508
510
|
}, new Decimal(0)).toNumber();
|
@@ -613,7 +615,7 @@ function AmountSummary(_ref2) {
|
|
613
615
|
if (paymentType === 'regular') {
|
614
616
|
var depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
615
617
|
if (item.order_payment_type === 'deposit') {
|
616
|
-
return acc.plus(item.amount).plus(
|
618
|
+
return acc.plus(item.amount).plus(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0);
|
617
619
|
}
|
618
620
|
return acc;
|
619
621
|
}, new Decimal(0)).toNumber();
|
@@ -625,7 +627,7 @@ function AmountSummary(_ref2) {
|
|
625
627
|
// 如果是定金支付,且定金已付款金额大于等于订单总金额,则不可以再切换到普通支付
|
626
628
|
var _depositPaidAmount = paymentItems === null || paymentItems === void 0 ? void 0 : paymentItems.reduce(function (acc, item) {
|
627
629
|
if (item.order_payment_type === 'deposit') {
|
628
|
-
return acc.plus(item.amount);
|
630
|
+
return acc.plus(item.amount).plus(Number(item.rounding_amount) > 0 ? 0 : item.rounding_amount || 0);
|
629
631
|
}
|
630
632
|
return acc;
|
631
633
|
}, new Decimal(0)).toNumber();
|
@@ -13,10 +13,12 @@ export interface CashPaymentModuleProps {
|
|
13
13
|
roundingDifference: number;
|
14
14
|
}>;
|
15
15
|
balanceDueAmount?: string;
|
16
|
+
balanceDueTotalAmount?: string;
|
16
17
|
syncingLock?: boolean;
|
17
18
|
}
|
18
19
|
export declare function CashPaymentModule({ amountSymbol, orderInfo, onPaymentComplete, customAmount, amountButtons, // 按钮列表,默认5个推荐金额
|
19
20
|
disabled, // 禁用状态
|
20
|
-
roundingFunction, balanceDueAmount, //
|
21
|
+
roundingFunction, balanceDueAmount, // 当前阶段剩余支付金额(定金或普通支付)
|
22
|
+
balanceDueTotalAmount, // 完整订单剩余待付金额
|
21
23
|
syncingLock, }: CashPaymentModuleProps): JSX.Element;
|
22
24
|
export default CashPaymentModule;
|
@@ -29,6 +29,8 @@ export function CashPaymentModule(_ref) {
|
|
29
29
|
roundingFunction = _ref.roundingFunction,
|
30
30
|
_ref$balanceDueAmount = _ref.balanceDueAmount,
|
31
31
|
balanceDueAmount = _ref$balanceDueAmount === void 0 ? '0' : _ref$balanceDueAmount,
|
32
|
+
_ref$balanceDueTotalA = _ref.balanceDueTotalAmount,
|
33
|
+
balanceDueTotalAmount = _ref$balanceDueTotalA === void 0 ? '0' : _ref$balanceDueTotalA,
|
32
34
|
_ref$syncingLock = _ref.syncingLock,
|
33
35
|
syncingLock = _ref$syncingLock === void 0 ? false : _ref$syncingLock;
|
34
36
|
var _useState = useState(customAmount || ''),
|
@@ -56,7 +58,7 @@ export function CashPaymentModule(_ref) {
|
|
56
58
|
};
|
57
59
|
useEffect(function () {
|
58
60
|
handleKeyboardConfirm(customAmount || '');
|
59
|
-
}, [customAmount, balanceDueAmount]);
|
61
|
+
}, [customAmount, balanceDueAmount, orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.isDeposit]);
|
60
62
|
|
61
63
|
// 检查是否应该禁用按钮:原本disabled为true 或者 订单金额为0
|
62
64
|
var isAmountButtonsDisabled = disabled || Number(customAmount || 0) === 0;
|
@@ -125,33 +127,35 @@ export function CashPaymentModule(_ref) {
|
|
125
127
|
break;
|
126
128
|
}
|
127
129
|
setAmount('');
|
128
|
-
_context.next =
|
130
|
+
_context.next = 33;
|
129
131
|
break;
|
130
132
|
case 13:
|
131
133
|
// 移除可能的货币符号和多余空格
|
132
134
|
cleanValue = finalValue.replace(/[$\s]/g, '');
|
133
135
|
numValue = parseFloat(cleanValue); // 检查当前金额是否等于剩余支付金额
|
134
|
-
|
136
|
+
debugger;
|
137
|
+
// 需要确认当前是否是定金模式,如果是定金模式则 balanceDue 应该为完整订单剩余待付金额
|
138
|
+
balanceDue = parseFloat(orderInfo !== null && orderInfo !== void 0 && orderInfo.isDeposit ? balanceDueTotalAmount || '0' : balanceDueAmount);
|
135
139
|
shouldApplyRounding = Math.abs(numValue - balanceDue) < 0.01; // 使用小数精度比较
|
136
140
|
finalAmount = numValue;
|
137
141
|
roundingDiff = 0;
|
138
142
|
if (!(shouldApplyRounding && roundingFunction)) {
|
139
|
-
_context.next =
|
143
|
+
_context.next = 30;
|
140
144
|
break;
|
141
145
|
}
|
142
|
-
_context.next =
|
146
|
+
_context.next = 23;
|
143
147
|
return roundingFunction(numValue);
|
144
|
-
case
|
148
|
+
case 23:
|
145
149
|
_result = _context.sent;
|
146
150
|
_ref3 = _result || {}, _ref3$roundedAmount = _ref3.roundedAmount, roundedAmount = _ref3$roundedAmount === void 0 ? numValue : _ref3$roundedAmount, _ref3$roundingDiffere = _ref3.roundingDifference, roundingDifference = _ref3$roundingDiffere === void 0 ? 0 : _ref3$roundingDiffere;
|
147
151
|
finalAmount = roundedAmount;
|
148
152
|
roundingDiff = roundingDifference;
|
149
153
|
console.log('应用抹零:', numValue, '->', roundedAmount, '差额:', roundingDifference);
|
150
|
-
_context.next =
|
154
|
+
_context.next = 31;
|
151
155
|
break;
|
152
|
-
case 29:
|
153
|
-
console.log('不应用抹零,用户输入金额:', numValue, '剩余支付金额:', balanceDue);
|
154
156
|
case 30:
|
157
|
+
console.log('不应用抹零,用户输入金额:', numValue, '剩余支付金额:', balanceDue);
|
158
|
+
case 31:
|
155
159
|
setRoundingAmount(roundingDiff);
|
156
160
|
if (isNaN(numValue)) {
|
157
161
|
setAmount('');
|
@@ -159,7 +163,7 @@ export function CashPaymentModule(_ref) {
|
|
159
163
|
setAmount(finalAmount.toString());
|
160
164
|
console.log('设置金额为:', finalAmount);
|
161
165
|
}
|
162
|
-
case
|
166
|
+
case 33:
|
163
167
|
case "end":
|
164
168
|
return _context.stop();
|
165
169
|
}
|