@pisell/private-materials 6.4.18 → 6.4.19
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 +11 -11
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +6 -6
- package/es/components/booking/components/tabPane/index.less +1 -1
- package/es/components/booking/utils.d.ts +2 -2
- package/es/components/checkout/PaymentModal.js +118 -117
- package/es/components/checkout/components/WalletPassModule/components/DiscountWallet/index.d.ts +0 -1
- package/lib/components/booking/components/tabPane/index.less +1 -1
- package/lib/components/booking/utils.d.ts +2 -2
- package/lib/components/checkout/PaymentModal.js +96 -92
- package/lib/components/checkout/components/WalletPassModule/components/DiscountWallet/index.d.ts +0 -1
- package/package.json +12 -12
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
|
|
165
165
|
export declare const getDuration: (duration: number | {
|
166
166
|
type: string;
|
167
167
|
value: number;
|
168
|
-
}) => number | {
|
168
|
+
}) => number | "flexible" | {
|
169
169
|
type: string;
|
170
170
|
value: number;
|
171
|
-
}
|
171
|
+
};
|
172
172
|
export declare const isWalkIn: (customer_id?: number | string) => boolean;
|
173
173
|
export declare const getIsEdit: (state: any) => boolean;
|
174
174
|
export {};
|
@@ -1603,7 +1603,7 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1603
1603
|
// 获取 checkout 模块并处理订单数据
|
1604
1604
|
checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
1605
1605
|
if (!(checkout && data && !isLocalOrderCreated.current)) {
|
1606
|
-
_context17.next =
|
1606
|
+
_context17.next = 19;
|
1607
1607
|
break;
|
1608
1608
|
}
|
1609
1609
|
isLocalOrderCreated.current = true;
|
@@ -1651,130 +1651,27 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1651
1651
|
unsubscribeRef.current();
|
1652
1652
|
unsubscribeRef.current = undefined;
|
1653
1653
|
}
|
1654
|
-
|
1655
|
-
unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', function (data) {
|
1656
|
-
var _data$response, _responseData$payment2;
|
1657
|
-
// 获取支付状态和相关信息
|
1658
|
-
var responseData = (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.data;
|
1659
|
-
// 获取支付状态
|
1660
|
-
var paymentStatus = responseData === null || responseData === void 0 ? void 0 : responseData.payment_status;
|
1661
|
-
if (data.isManual) return;
|
1662
|
-
handlePaymentComplete(data);
|
1663
|
-
// 如果正在显示现金支付 toast,跳过自动关闭逻辑
|
1664
|
-
if (showingCashToastRef.current) {
|
1665
|
-
return;
|
1666
|
-
}
|
1667
|
-
|
1668
|
-
// 获取订单总金额
|
1669
|
-
var orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
|
1670
|
-
var gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
|
1671
|
-
var 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) || 0);
|
1672
|
-
// const changeDue = Number(responseData?.amount_gap || 0);
|
1673
|
-
// 获取失败原因
|
1674
|
-
var failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason;
|
1675
|
-
|
1676
|
-
// 根据支付状态弹出对应的支付结果toast
|
1677
|
-
if (paymentStatus) {
|
1678
|
-
// 打印订单完整信息
|
1679
|
-
console.log('print_order_onOrderSynced>>>>', responseData);
|
1680
|
-
logger === null || logger === void 0 || logger.addLog({
|
1681
|
-
type: 'info',
|
1682
|
-
title: 'print_order_onOrderSynced',
|
1683
|
-
metadata: {
|
1684
|
-
responseData: responseData
|
1685
|
-
}
|
1686
|
-
});
|
1687
|
-
try {
|
1688
|
-
var _responseData$payment3;
|
1689
|
-
var params = {
|
1690
|
-
type: '99',
|
1691
|
-
// 打印订单全部信息
|
1692
|
-
data: {
|
1693
|
-
order_id: responseData.order_id,
|
1694
|
-
machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
|
1695
|
-
small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment3 = responseData.payment_info) === null || _responseData$payment3 === void 0 ? void 0 : _responseData$payment3.small_ticket_data
|
1696
|
-
}
|
1697
|
-
};
|
1698
|
-
console.log('print_order_onOrderSynced_params>>>>', params);
|
1699
|
-
logger === null || logger === void 0 || logger.addLog({
|
1700
|
-
type: 'info',
|
1701
|
-
title: 'print_order_onOrderSynced_params',
|
1702
|
-
metadata: {
|
1703
|
-
params: params
|
1704
|
-
}
|
1705
|
-
});
|
1706
|
-
webPrint(params, function (res) {
|
1707
|
-
console.log('print_order_onOrderSynced_res>>>>', res);
|
1708
|
-
logger === null || logger === void 0 || logger.addLog({
|
1709
|
-
type: 'info',
|
1710
|
-
title: 'print_order_onOrderSynced_res',
|
1711
|
-
metadata: {
|
1712
|
-
res: res
|
1713
|
-
}
|
1714
|
-
});
|
1715
|
-
});
|
1716
|
-
} catch (error) {
|
1717
|
-
console.error('print_order_onOrderSynced_error>>>>', error);
|
1718
|
-
logger === null || logger === void 0 || logger.addLog({
|
1719
|
-
type: 'info',
|
1720
|
-
title: 'print_order_onOrderSynced_error',
|
1721
|
-
metadata: {
|
1722
|
-
error: error
|
1723
|
-
}
|
1724
|
-
});
|
1725
|
-
}
|
1726
|
-
|
1727
|
-
// 确定支付状态
|
1728
|
-
var statusClassName = calculateStatusClassName(paymentStatus);
|
1729
|
-
var autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
|
1730
|
-
|
1731
|
-
// 根据支付状态展示不同的 toast
|
1732
|
-
displayPaymentResultToast({
|
1733
|
-
paymentStatus: paymentStatus,
|
1734
|
-
orderTotalAmount: orderTotalAmount,
|
1735
|
-
gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
|
1736
|
-
failureReason: failureReason,
|
1737
|
-
autoCloseConfig: autoCloseConfig,
|
1738
|
-
actionButtons: generateActionButtons(paymentStatus)
|
1739
|
-
}, paymentResultToastConfig);
|
1740
|
-
|
1741
|
-
// 将支付结果信息传递给回调处理
|
1742
|
-
var paymentResult = _objectSpread(_objectSpread({}, data), {}, {
|
1743
|
-
toastInfo: {
|
1744
|
-
status: paymentStatus,
|
1745
|
-
amount: orderTotalAmount,
|
1746
|
-
gapAmount: currentChangeGivenAmount,
|
1747
|
-
failureReason: failureReason
|
1748
|
-
}
|
1749
|
-
});
|
1750
|
-
handlePaymentComplete(paymentResult);
|
1751
|
-
} else {
|
1752
|
-
handlePaymentComplete(data);
|
1753
|
-
}
|
1754
|
-
// 可以在这里执行同步完成后的业务逻辑
|
1755
|
-
// 比如:通知其他系统、更新UI状态等
|
1756
|
-
});
|
1757
|
-
_context17.next = 31;
|
1654
|
+
_context17.next = 30;
|
1758
1655
|
break;
|
1759
|
-
case
|
1656
|
+
case 19:
|
1760
1657
|
if (!isLocalOrderCreated.current) {
|
1761
|
-
_context17.next =
|
1658
|
+
_context17.next = 30;
|
1762
1659
|
break;
|
1763
1660
|
}
|
1764
1661
|
// // 如果本地订单已创建,这时候还更新了 data,则需要销毁当前的订单数据,然后更新新的订单数据了
|
1765
1662
|
console.log('🔄 PaymentModal: data changed, updating checkout data...');
|
1766
1663
|
isLocalOrderCreated.current = false;
|
1767
|
-
_context17.next =
|
1664
|
+
_context17.next = 24;
|
1768
1665
|
return checkout.cancelCurrentOrderAsync();
|
1769
|
-
case
|
1770
|
-
_context17.next =
|
1666
|
+
case 24:
|
1667
|
+
_context17.next = 26;
|
1771
1668
|
return checkout.createLocalOrderAsync({
|
1772
1669
|
orderData: data === null || data === void 0 ? void 0 : data.order_info,
|
1773
1670
|
cartSummary: data === null || data === void 0 || (_data$subtotal_info = data.subtotal_info) === null || _data$subtotal_info === void 0 ? void 0 : _data$subtotal_info.subTotalList,
|
1774
1671
|
autoPayment: true,
|
1775
1672
|
totalInfo: data === null || data === void 0 ? void 0 : data.subtotal_info
|
1776
1673
|
});
|
1777
|
-
case
|
1674
|
+
case 26:
|
1778
1675
|
// 获取订单总金额
|
1779
1676
|
_orderInfo3 = checkout.getCurrentOrderInfo();
|
1780
1677
|
if (_orderInfo3 && _orderInfo3.totalAmount) {
|
@@ -1782,11 +1679,11 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1782
1679
|
}
|
1783
1680
|
setOrderInfo(_orderInfo3);
|
1784
1681
|
isLocalOrderCreated.current = true;
|
1785
|
-
case
|
1786
|
-
_context17.next =
|
1682
|
+
case 30:
|
1683
|
+
_context17.next = 36;
|
1787
1684
|
break;
|
1788
|
-
case
|
1789
|
-
_context17.prev =
|
1685
|
+
case 32:
|
1686
|
+
_context17.prev = 32;
|
1790
1687
|
_context17.t0 = _context17["catch"](0);
|
1791
1688
|
console.error('Failed to initialize checkout data:', _context17.t0);
|
1792
1689
|
logger === null || logger === void 0 || logger.addLog({
|
@@ -1796,11 +1693,11 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1796
1693
|
error: _context17.t0
|
1797
1694
|
}
|
1798
1695
|
});
|
1799
|
-
case
|
1696
|
+
case 36:
|
1800
1697
|
case "end":
|
1801
1698
|
return _context17.stop();
|
1802
1699
|
}
|
1803
|
-
}, _callee17, null, [[0,
|
1700
|
+
}, _callee17, null, [[0, 32]]);
|
1804
1701
|
}));
|
1805
1702
|
return function initCheckoutData() {
|
1806
1703
|
return _ref22.apply(this, arguments);
|
@@ -1811,6 +1708,110 @@ var PaymentModal = function PaymentModal(_ref17) {
|
|
1811
1708
|
}
|
1812
1709
|
}, [data]);
|
1813
1710
|
useEffect(function () {
|
1711
|
+
var checkout = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule('checkout');
|
1712
|
+
// 监听订单同步完成,同步完成后显示订单完成 toast,关闭当前弹窗
|
1713
|
+
unsubscribeRef.current = checkout.core.effects.on('checkout:onOrderSynced', function (data) {
|
1714
|
+
var _data$response, _responseData$payment2;
|
1715
|
+
// 获取支付状态和相关信息
|
1716
|
+
var responseData = (_data$response = data.response) === null || _data$response === void 0 ? void 0 : _data$response.data;
|
1717
|
+
// 获取支付状态
|
1718
|
+
var paymentStatus = responseData === null || responseData === void 0 ? void 0 : responseData.payment_status;
|
1719
|
+
if (data.isManual) return;
|
1720
|
+
handlePaymentComplete(data);
|
1721
|
+
// 如果正在显示现金支付 toast,跳过自动关闭逻辑
|
1722
|
+
if (showingCashToastRef.current) {
|
1723
|
+
return;
|
1724
|
+
}
|
1725
|
+
|
1726
|
+
// 获取订单总金额
|
1727
|
+
var orderTotalAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.total_amount) || 0);
|
1728
|
+
var gapAmount = Number((responseData === null || responseData === void 0 ? void 0 : responseData.amount_gap) || 0);
|
1729
|
+
var 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) || 0);
|
1730
|
+
// const changeDue = Number(responseData?.amount_gap || 0);
|
1731
|
+
// 获取失败原因
|
1732
|
+
var failureReason = responseData === null || responseData === void 0 ? void 0 : responseData.failure_reason;
|
1733
|
+
|
1734
|
+
// 根据支付状态弹出对应的支付结果toast
|
1735
|
+
if (paymentStatus) {
|
1736
|
+
// 打印订单完整信息
|
1737
|
+
console.log('print_order_onOrderSynced>>>>', responseData);
|
1738
|
+
logger === null || logger === void 0 || logger.addLog({
|
1739
|
+
type: 'info',
|
1740
|
+
title: 'print_order_onOrderSynced',
|
1741
|
+
metadata: {
|
1742
|
+
responseData: responseData
|
1743
|
+
}
|
1744
|
+
});
|
1745
|
+
try {
|
1746
|
+
var _responseData$payment3;
|
1747
|
+
var params = {
|
1748
|
+
type: '99',
|
1749
|
+
// 打印订单全部信息
|
1750
|
+
data: {
|
1751
|
+
order_id: responseData.order_id,
|
1752
|
+
machine_code_print_info: responseData === null || responseData === void 0 ? void 0 : responseData.machine_code_print_info,
|
1753
|
+
small_ticket_data: responseData === null || responseData === void 0 || (_responseData$payment3 = responseData.payment_info) === null || _responseData$payment3 === void 0 ? void 0 : _responseData$payment3.small_ticket_data
|
1754
|
+
}
|
1755
|
+
};
|
1756
|
+
console.log('print_order_onOrderSynced_params>>>>', params);
|
1757
|
+
logger === null || logger === void 0 || logger.addLog({
|
1758
|
+
type: 'info',
|
1759
|
+
title: 'print_order_onOrderSynced_params',
|
1760
|
+
metadata: {
|
1761
|
+
params: params
|
1762
|
+
}
|
1763
|
+
});
|
1764
|
+
webPrint(params, function (res) {
|
1765
|
+
console.log('print_order_onOrderSynced_res>>>>', res);
|
1766
|
+
logger === null || logger === void 0 || logger.addLog({
|
1767
|
+
type: 'info',
|
1768
|
+
title: 'print_order_onOrderSynced_res',
|
1769
|
+
metadata: {
|
1770
|
+
res: res
|
1771
|
+
}
|
1772
|
+
});
|
1773
|
+
});
|
1774
|
+
} catch (error) {
|
1775
|
+
console.error('print_order_onOrderSynced_error>>>>', error);
|
1776
|
+
logger === null || logger === void 0 || logger.addLog({
|
1777
|
+
type: 'info',
|
1778
|
+
title: 'print_order_onOrderSynced_error',
|
1779
|
+
metadata: {
|
1780
|
+
error: error
|
1781
|
+
}
|
1782
|
+
});
|
1783
|
+
}
|
1784
|
+
|
1785
|
+
// 确定支付状态
|
1786
|
+
var statusClassName = calculateStatusClassName(paymentStatus);
|
1787
|
+
var autoCloseConfig = calculateAutoCloseConfig(paymentStatus, !!currentChangeGivenAmount);
|
1788
|
+
|
1789
|
+
// 根据支付状态展示不同的 toast
|
1790
|
+
displayPaymentResultToast({
|
1791
|
+
paymentStatus: paymentStatus,
|
1792
|
+
orderTotalAmount: orderTotalAmount,
|
1793
|
+
gapAmount: paymentStatus === 'partially_paid' ? gapAmount : currentChangeGivenAmount,
|
1794
|
+
failureReason: failureReason,
|
1795
|
+
autoCloseConfig: autoCloseConfig,
|
1796
|
+
actionButtons: generateActionButtons(paymentStatus)
|
1797
|
+
}, paymentResultToastConfig);
|
1798
|
+
|
1799
|
+
// 将支付结果信息传递给回调处理
|
1800
|
+
var paymentResult = _objectSpread(_objectSpread({}, data), {}, {
|
1801
|
+
toastInfo: {
|
1802
|
+
status: paymentStatus,
|
1803
|
+
amount: orderTotalAmount,
|
1804
|
+
gapAmount: currentChangeGivenAmount,
|
1805
|
+
failureReason: failureReason
|
1806
|
+
}
|
1807
|
+
});
|
1808
|
+
handlePaymentComplete(paymentResult);
|
1809
|
+
} else {
|
1810
|
+
handlePaymentComplete(data);
|
1811
|
+
}
|
1812
|
+
// 可以在这里执行同步完成后的业务逻辑
|
1813
|
+
// 比如:通知其他系统、更新UI状态等
|
1814
|
+
});
|
1814
1815
|
return function () {
|
1815
1816
|
if (typeof unsubscribeRef.current === 'function') {
|
1816
1817
|
var _unsubscribeRef$curre;
|
@@ -165,10 +165,10 @@ export declare const getProductTotalPrice: (item: any) => number;
|
|
165
165
|
export declare const getDuration: (duration: number | {
|
166
166
|
type: string;
|
167
167
|
value: number;
|
168
|
-
}) => number | {
|
168
|
+
}) => number | "flexible" | {
|
169
169
|
type: string;
|
170
170
|
value: number;
|
171
|
-
}
|
171
|
+
};
|
172
172
|
export declare const isWalkIn: (customer_id?: number | string) => boolean;
|
173
173
|
export declare const getIsEdit: (state: any) => boolean;
|
174
174
|
export {};
|
@@ -1234,98 +1234,6 @@ var PaymentModal = ({
|
|
1234
1234
|
unsubscribeRef.current();
|
1235
1235
|
unsubscribeRef.current = void 0;
|
1236
1236
|
}
|
1237
|
-
unsubscribeRef.current = checkout.core.effects.on("checkout:onOrderSynced", (data2) => {
|
1238
|
-
var _a3, _b3, _c2;
|
1239
|
-
const responseData = (_a3 = data2.response) == null ? void 0 : _a3.data;
|
1240
|
-
const paymentStatus = responseData == null ? void 0 : responseData.payment_status;
|
1241
|
-
if (data2.isManual) return;
|
1242
|
-
handlePaymentComplete(data2);
|
1243
|
-
if (showingCashToastRef.current) {
|
1244
|
-
return;
|
1245
|
-
}
|
1246
|
-
const orderTotalAmount = Number((responseData == null ? void 0 : responseData.total_amount) || 0);
|
1247
|
-
const gapAmount = Number((responseData == null ? void 0 : responseData.amount_gap) || 0);
|
1248
|
-
const currentChangeGivenAmount = Number(
|
1249
|
-
((_b3 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _b3.current_change_given_amount) || 0
|
1250
|
-
);
|
1251
|
-
const failureReason = responseData == null ? void 0 : responseData.failure_reason;
|
1252
|
-
if (paymentStatus) {
|
1253
|
-
console.log("print_order_onOrderSynced>>>>", responseData);
|
1254
|
-
logger == null ? void 0 : logger.addLog({
|
1255
|
-
type: "info",
|
1256
|
-
title: "print_order_onOrderSynced",
|
1257
|
-
metadata: {
|
1258
|
-
responseData
|
1259
|
-
}
|
1260
|
-
});
|
1261
|
-
try {
|
1262
|
-
const params = {
|
1263
|
-
type: "99",
|
1264
|
-
// 打印订单全部信息
|
1265
|
-
data: {
|
1266
|
-
order_id: responseData.order_id,
|
1267
|
-
machine_code_print_info: responseData == null ? void 0 : responseData.machine_code_print_info,
|
1268
|
-
small_ticket_data: (_c2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _c2.small_ticket_data
|
1269
|
-
}
|
1270
|
-
};
|
1271
|
-
console.log("print_order_onOrderSynced_params>>>>", params);
|
1272
|
-
logger == null ? void 0 : logger.addLog({
|
1273
|
-
type: "info",
|
1274
|
-
title: "print_order_onOrderSynced_params",
|
1275
|
-
metadata: {
|
1276
|
-
params
|
1277
|
-
}
|
1278
|
-
});
|
1279
|
-
(0, import_utils.webPrint)(params, (res) => {
|
1280
|
-
console.log("print_order_onOrderSynced_res>>>>", res);
|
1281
|
-
logger == null ? void 0 : logger.addLog({
|
1282
|
-
type: "info",
|
1283
|
-
title: "print_order_onOrderSynced_res",
|
1284
|
-
metadata: {
|
1285
|
-
res
|
1286
|
-
}
|
1287
|
-
});
|
1288
|
-
});
|
1289
|
-
} catch (error) {
|
1290
|
-
console.error("print_order_onOrderSynced_error>>>>", error);
|
1291
|
-
logger == null ? void 0 : logger.addLog({
|
1292
|
-
type: "info",
|
1293
|
-
title: "print_order_onOrderSynced_error",
|
1294
|
-
metadata: {
|
1295
|
-
error
|
1296
|
-
}
|
1297
|
-
});
|
1298
|
-
}
|
1299
|
-
const statusClassName = (0, import_PaymentResultToastUtils.calculateStatusClassName)(paymentStatus);
|
1300
|
-
const autoCloseConfig = (0, import_PaymentResultToastUtils.calculateAutoCloseConfig)(
|
1301
|
-
paymentStatus,
|
1302
|
-
!!currentChangeGivenAmount
|
1303
|
-
);
|
1304
|
-
(0, import_PaymentResultToastUtils.displayPaymentResultToast)(
|
1305
|
-
{
|
1306
|
-
paymentStatus,
|
1307
|
-
orderTotalAmount,
|
1308
|
-
gapAmount: paymentStatus === "partially_paid" ? gapAmount : currentChangeGivenAmount,
|
1309
|
-
failureReason,
|
1310
|
-
autoCloseConfig,
|
1311
|
-
actionButtons: generateActionButtons(paymentStatus)
|
1312
|
-
},
|
1313
|
-
paymentResultToastConfig
|
1314
|
-
);
|
1315
|
-
const paymentResult = {
|
1316
|
-
...data2,
|
1317
|
-
toastInfo: {
|
1318
|
-
status: paymentStatus,
|
1319
|
-
amount: orderTotalAmount,
|
1320
|
-
gapAmount: currentChangeGivenAmount,
|
1321
|
-
failureReason
|
1322
|
-
}
|
1323
|
-
};
|
1324
|
-
handlePaymentComplete(paymentResult);
|
1325
|
-
} else {
|
1326
|
-
handlePaymentComplete(data2);
|
1327
|
-
}
|
1328
|
-
});
|
1329
1237
|
} else if (isLocalOrderCreated.current) {
|
1330
1238
|
console.log(
|
1331
1239
|
"🔄 PaymentModal: data changed, updating checkout data..."
|
@@ -1361,6 +1269,102 @@ var PaymentModal = ({
|
|
1361
1269
|
}
|
1362
1270
|
}, [data]);
|
1363
1271
|
(0, import_react.useEffect)(() => {
|
1272
|
+
const checkout = pisellos == null ? void 0 : pisellos.getModule("checkout");
|
1273
|
+
unsubscribeRef.current = checkout.core.effects.on(
|
1274
|
+
"checkout:onOrderSynced",
|
1275
|
+
(data2) => {
|
1276
|
+
var _a2, _b2, _c2;
|
1277
|
+
const responseData = (_a2 = data2.response) == null ? void 0 : _a2.data;
|
1278
|
+
const paymentStatus = responseData == null ? void 0 : responseData.payment_status;
|
1279
|
+
if (data2.isManual) return;
|
1280
|
+
handlePaymentComplete(data2);
|
1281
|
+
if (showingCashToastRef.current) {
|
1282
|
+
return;
|
1283
|
+
}
|
1284
|
+
const orderTotalAmount = Number((responseData == null ? void 0 : responseData.total_amount) || 0);
|
1285
|
+
const gapAmount = Number((responseData == null ? void 0 : responseData.amount_gap) || 0);
|
1286
|
+
const currentChangeGivenAmount = Number(
|
1287
|
+
((_b2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _b2.current_change_given_amount) || 0
|
1288
|
+
);
|
1289
|
+
const failureReason = responseData == null ? void 0 : responseData.failure_reason;
|
1290
|
+
if (paymentStatus) {
|
1291
|
+
console.log("print_order_onOrderSynced>>>>", responseData);
|
1292
|
+
logger == null ? void 0 : logger.addLog({
|
1293
|
+
type: "info",
|
1294
|
+
title: "print_order_onOrderSynced",
|
1295
|
+
metadata: {
|
1296
|
+
responseData
|
1297
|
+
}
|
1298
|
+
});
|
1299
|
+
try {
|
1300
|
+
const params = {
|
1301
|
+
type: "99",
|
1302
|
+
// 打印订单全部信息
|
1303
|
+
data: {
|
1304
|
+
order_id: responseData.order_id,
|
1305
|
+
machine_code_print_info: responseData == null ? void 0 : responseData.machine_code_print_info,
|
1306
|
+
small_ticket_data: (_c2 = responseData == null ? void 0 : responseData.payment_info) == null ? void 0 : _c2.small_ticket_data
|
1307
|
+
}
|
1308
|
+
};
|
1309
|
+
console.log("print_order_onOrderSynced_params>>>>", params);
|
1310
|
+
logger == null ? void 0 : logger.addLog({
|
1311
|
+
type: "info",
|
1312
|
+
title: "print_order_onOrderSynced_params",
|
1313
|
+
metadata: {
|
1314
|
+
params
|
1315
|
+
}
|
1316
|
+
});
|
1317
|
+
(0, import_utils.webPrint)(params, (res) => {
|
1318
|
+
console.log("print_order_onOrderSynced_res>>>>", res);
|
1319
|
+
logger == null ? void 0 : logger.addLog({
|
1320
|
+
type: "info",
|
1321
|
+
title: "print_order_onOrderSynced_res",
|
1322
|
+
metadata: {
|
1323
|
+
res
|
1324
|
+
}
|
1325
|
+
});
|
1326
|
+
});
|
1327
|
+
} catch (error) {
|
1328
|
+
console.error("print_order_onOrderSynced_error>>>>", error);
|
1329
|
+
logger == null ? void 0 : logger.addLog({
|
1330
|
+
type: "info",
|
1331
|
+
title: "print_order_onOrderSynced_error",
|
1332
|
+
metadata: {
|
1333
|
+
error
|
1334
|
+
}
|
1335
|
+
});
|
1336
|
+
}
|
1337
|
+
const statusClassName = (0, import_PaymentResultToastUtils.calculateStatusClassName)(paymentStatus);
|
1338
|
+
const autoCloseConfig = (0, import_PaymentResultToastUtils.calculateAutoCloseConfig)(
|
1339
|
+
paymentStatus,
|
1340
|
+
!!currentChangeGivenAmount
|
1341
|
+
);
|
1342
|
+
(0, import_PaymentResultToastUtils.displayPaymentResultToast)(
|
1343
|
+
{
|
1344
|
+
paymentStatus,
|
1345
|
+
orderTotalAmount,
|
1346
|
+
gapAmount: paymentStatus === "partially_paid" ? gapAmount : currentChangeGivenAmount,
|
1347
|
+
failureReason,
|
1348
|
+
autoCloseConfig,
|
1349
|
+
actionButtons: generateActionButtons(paymentStatus)
|
1350
|
+
},
|
1351
|
+
paymentResultToastConfig
|
1352
|
+
);
|
1353
|
+
const paymentResult = {
|
1354
|
+
...data2,
|
1355
|
+
toastInfo: {
|
1356
|
+
status: paymentStatus,
|
1357
|
+
amount: orderTotalAmount,
|
1358
|
+
gapAmount: currentChangeGivenAmount,
|
1359
|
+
failureReason
|
1360
|
+
}
|
1361
|
+
};
|
1362
|
+
handlePaymentComplete(paymentResult);
|
1363
|
+
} else {
|
1364
|
+
handlePaymentComplete(data2);
|
1365
|
+
}
|
1366
|
+
}
|
1367
|
+
);
|
1364
1368
|
return () => {
|
1365
1369
|
var _a2;
|
1366
1370
|
if (typeof unsubscribeRef.current === "function") {
|
package/package.json
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pisell/private-materials",
|
3
|
-
"version": "6.4.
|
3
|
+
"version": "6.4.19",
|
4
|
+
"scripts": {
|
5
|
+
"dev": "father dev",
|
6
|
+
"build": "father build",
|
7
|
+
"lowcode:dev": "build-scripts start --config ./build.lowcode.js",
|
8
|
+
"lowcode:build": " build-scripts build --config ./build.lowcode.js"
|
9
|
+
},
|
4
10
|
"main": "./lib/index.js",
|
5
11
|
"module": "./es/index.js",
|
6
12
|
"types": "./lib/index.d.ts",
|
@@ -50,6 +56,10 @@
|
|
50
56
|
"@dnd-kit/modifiers": "^6.0.1",
|
51
57
|
"@dnd-kit/sortable": "^7.0.2",
|
52
58
|
"@dnd-kit/utilities": "^3.2.1",
|
59
|
+
"@pisell/date-picker": "workspace:*",
|
60
|
+
"@pisell/icon": "workspace:*",
|
61
|
+
"@pisell/materials": "workspace:*",
|
62
|
+
"@pisell/utils": "workspace:*",
|
53
63
|
"ahooks": "^3.7.6",
|
54
64
|
"antd": "^5.6.3",
|
55
65
|
"classnames": "^2.3.2",
|
@@ -58,11 +68,7 @@
|
|
58
68
|
"rc-virtual-list": "^3.11.3",
|
59
69
|
"react-infinite-scroll-component": "^6.1.0",
|
60
70
|
"react-resizable": "^3.0.5",
|
61
|
-
"styled-components": "^6.0.0-rc.3"
|
62
|
-
"@pisell/date-picker": "3.0.7",
|
63
|
-
"@pisell/icon": "0.0.11",
|
64
|
-
"@pisell/utils": "3.0.2",
|
65
|
-
"@pisell/materials": "6.4.3"
|
71
|
+
"styled-components": "^6.0.0-rc.3"
|
66
72
|
},
|
67
73
|
"peerDependencies": {
|
68
74
|
"react": "^18.0.0",
|
@@ -70,11 +76,5 @@
|
|
70
76
|
},
|
71
77
|
"componentConfig": {
|
72
78
|
"materialSchema": "https://unpkg.com/@pisell/materials@1.0.1/build/lowcode/assets-prod.json"
|
73
|
-
},
|
74
|
-
"scripts": {
|
75
|
-
"dev": "father dev",
|
76
|
-
"build": "father build",
|
77
|
-
"lowcode:dev": "build-scripts start --config ./build.lowcode.js",
|
78
|
-
"lowcode:build": " build-scripts build --config ./build.lowcode.js"
|
79
79
|
}
|
80
80
|
}
|