@pisell/pisellos 0.0.250 → 0.0.251
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/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.d.ts +3 -1
- package/dist/solution/Checkout/index.js +78 -67
- package/dist/solution/Checkout/types.d.ts +4 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.d.ts +3 -1
- package/lib/solution/Checkout/index.js +32 -25
- package/lib/solution/Checkout/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -314,7 +314,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
314
314
|
}[];
|
|
315
315
|
setOtherData(key: string, value: any): void;
|
|
316
316
|
getOtherData(key: string): any;
|
|
317
|
-
getProductTypeById(id: number): Promise<"
|
|
317
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
318
318
|
/**
|
|
319
319
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
320
320
|
*
|
|
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
111
111
|
* 获取当前的客户搜索条件
|
|
112
112
|
* @returns 当前搜索条件
|
|
113
113
|
*/
|
|
114
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -276,6 +276,7 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
276
276
|
message?: string;
|
|
277
277
|
orderId?: string;
|
|
278
278
|
orderUuid?: string;
|
|
279
|
+
response?: any;
|
|
279
280
|
}>;
|
|
280
281
|
/**
|
|
281
282
|
* 获取当前订单备注
|
|
@@ -319,6 +320,7 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
319
320
|
message?: string;
|
|
320
321
|
orderId?: string;
|
|
321
322
|
orderUuid?: string;
|
|
323
|
+
response?: any;
|
|
322
324
|
}>;
|
|
323
325
|
/**
|
|
324
326
|
* 获取当前商店折扣金额
|
|
@@ -440,7 +442,7 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
440
442
|
*
|
|
441
443
|
* @param isManual 是否为手动同步,默认为 false
|
|
442
444
|
* @param customPaymentItems 自定义支付项列表,如果提供则使用此列表而不是从数据库获取
|
|
443
|
-
* @returns
|
|
445
|
+
* @returns 包含订单ID、UUID和完整后端响应的对象
|
|
444
446
|
*/
|
|
445
447
|
private syncOrderToBackendWithReturn;
|
|
446
448
|
private syncOrderToBackend;
|
|
@@ -399,7 +399,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
399
399
|
key: "createLocalOrderAsync",
|
|
400
400
|
value: (function () {
|
|
401
401
|
var _createLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
402
|
-
var _params$totalInfo, _params$totalInfo2, _params$totalInfo3, validation, localOrderId, amountInfo, customerInfo, paymentOrder;
|
|
402
|
+
var _params$totalInfo, _params$totalInfo2, _params$totalInfo3, _params$totalInfo4, validation, localOrderId, amountInfo, customerInfo, paymentOrder;
|
|
403
403
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
404
404
|
while (1) switch (_context9.prev = _context9.next) {
|
|
405
405
|
case 0:
|
|
@@ -429,6 +429,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
429
429
|
params.orderData.surcharges = (_params$totalInfo2 = params.totalInfo) === null || _params$totalInfo2 === void 0 || (_params$totalInfo2 = _params$totalInfo2.total) === null || _params$totalInfo2 === void 0 ? void 0 : _params$totalInfo2.surcharge;
|
|
430
430
|
// 补充订单折扣信息
|
|
431
431
|
params.orderData.shop_discount = (_params$totalInfo3 = params.totalInfo) === null || _params$totalInfo3 === void 0 || (_params$totalInfo3 = _params$totalInfo3.total) === null || _params$totalInfo3 === void 0 ? void 0 : _params$totalInfo3.shopDiscount;
|
|
432
|
+
// 补充税费信息
|
|
433
|
+
params.orderData.tax = (_params$totalInfo4 = params.totalInfo) === null || _params$totalInfo4 === void 0 || (_params$totalInfo4 = _params$totalInfo4.total) === null || _params$totalInfo4 === void 0 ? void 0 : _params$totalInfo4.tax;
|
|
432
434
|
|
|
433
435
|
// 保存原始订单数据和小计数据到状态中
|
|
434
436
|
this.store.localOrderData = params.orderData;
|
|
@@ -448,7 +450,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
448
450
|
}
|
|
449
451
|
|
|
450
452
|
// 创建支付订单对象
|
|
451
|
-
_context9.next =
|
|
453
|
+
_context9.next = 22;
|
|
452
454
|
return this.payment.createPaymentOrderAsync({
|
|
453
455
|
order_id: localOrderId,
|
|
454
456
|
total_amount: amountInfo.totalAmount,
|
|
@@ -465,32 +467,32 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
465
467
|
amount_breakdown: amountInfo
|
|
466
468
|
}
|
|
467
469
|
});
|
|
468
|
-
case
|
|
470
|
+
case 22:
|
|
469
471
|
paymentOrder = _context9.sent;
|
|
470
472
|
this.store.currentOrder = paymentOrder;
|
|
471
473
|
this.initWalletData();
|
|
472
|
-
_context9.next =
|
|
474
|
+
_context9.next = 27;
|
|
473
475
|
return this.setStatus(CheckoutStatus.OrderCreated);
|
|
474
|
-
case
|
|
475
|
-
_context9.next =
|
|
476
|
+
case 27:
|
|
477
|
+
_context9.next = 29;
|
|
476
478
|
return this.setStep(CheckoutStep.PaymentMethod);
|
|
477
|
-
case
|
|
479
|
+
case 29:
|
|
478
480
|
if (!params.autoPayment) {
|
|
479
|
-
_context9.next =
|
|
481
|
+
_context9.next = 32;
|
|
480
482
|
break;
|
|
481
483
|
}
|
|
482
|
-
_context9.next =
|
|
484
|
+
_context9.next = 32;
|
|
483
485
|
return this.setStep(CheckoutStep.PaymentProcessing);
|
|
484
|
-
case
|
|
486
|
+
case 32:
|
|
485
487
|
this.core.effects.emit(CheckoutHooks.OnOrderCreated, {
|
|
486
488
|
order: paymentOrder,
|
|
487
489
|
timestamp: Date.now()
|
|
488
490
|
});
|
|
489
491
|
|
|
490
492
|
// 自动设置 stateAmount 为剩余未支付金额
|
|
491
|
-
_context9.next =
|
|
493
|
+
_context9.next = 35;
|
|
492
494
|
return this.updateStateAmountToRemaining();
|
|
493
|
-
case
|
|
495
|
+
case 35:
|
|
494
496
|
console.log('[Checkout] 本地订单创建成功:', {
|
|
495
497
|
localOrderId: localOrderId,
|
|
496
498
|
uuid: paymentOrder.uuid,
|
|
@@ -500,22 +502,22 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
500
502
|
stateAmount: this.store.stateAmount
|
|
501
503
|
});
|
|
502
504
|
return _context9.abrupt("return", paymentOrder);
|
|
503
|
-
case
|
|
504
|
-
_context9.prev =
|
|
505
|
+
case 39:
|
|
506
|
+
_context9.prev = 39;
|
|
505
507
|
_context9.t0 = _context9["catch"](0);
|
|
506
|
-
_context9.next =
|
|
508
|
+
_context9.next = 43;
|
|
507
509
|
return this.handleError(_context9.t0, CheckoutErrorType.OrderCreationFailed);
|
|
508
|
-
case
|
|
510
|
+
case 43:
|
|
509
511
|
this.core.effects.emit(CheckoutHooks.OnOrderCreationFailed, {
|
|
510
512
|
error: this.store.lastError,
|
|
511
513
|
timestamp: Date.now()
|
|
512
514
|
});
|
|
513
515
|
throw _context9.t0;
|
|
514
|
-
case
|
|
516
|
+
case 45:
|
|
515
517
|
case "end":
|
|
516
518
|
return _context9.stop();
|
|
517
519
|
}
|
|
518
|
-
}, _callee9, this, [[0,
|
|
520
|
+
}, _callee9, this, [[0, 39]]);
|
|
519
521
|
}));
|
|
520
522
|
function createLocalOrderAsync(_x11) {
|
|
521
523
|
return _createLocalOrderAsync.apply(this, arguments);
|
|
@@ -1660,7 +1662,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1660
1662
|
key: "addPaymentItemAsync",
|
|
1661
1663
|
value: (function () {
|
|
1662
1664
|
var _addPaymentItemAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(paymentItem) {
|
|
1663
|
-
var _paymentItem$type, _paymentItem$code, orderPaymentType, metadata, paymentItemWithType, isEftposPayment;
|
|
1665
|
+
var _paymentItem$type, _paymentItem$code, orderPaymentType, metadata, paymentItemWithType, isEftposPayment, syncResult;
|
|
1664
1666
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
1665
1667
|
while (1) switch (_context25.prev = _context25.next) {
|
|
1666
1668
|
case 0:
|
|
@@ -1713,7 +1715,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1713
1715
|
currentOrderSynced: this.store.isOrderSynced
|
|
1714
1716
|
});
|
|
1715
1717
|
if (!isEftposPayment) {
|
|
1716
|
-
_context25.next =
|
|
1718
|
+
_context25.next = 26;
|
|
1717
1719
|
break;
|
|
1718
1720
|
}
|
|
1719
1721
|
console.log('[Checkout] 检测到 EFTPOS 支付,立即同步订单到后端...');
|
|
@@ -1721,46 +1723,48 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1721
1723
|
_context25.next = 17;
|
|
1722
1724
|
return this.syncOrderToBackendWithReturn(true);
|
|
1723
1725
|
case 17:
|
|
1726
|
+
syncResult = _context25.sent;
|
|
1724
1727
|
console.log('[Checkout] EFTPOS 支付后订单同步完成 (已标记为手动同步):', {
|
|
1725
|
-
订单ID:
|
|
1726
|
-
是否已同步: this.store.isOrderSynced
|
|
1728
|
+
订单ID: syncResult.orderId,
|
|
1729
|
+
是否已同步: this.store.isOrderSynced,
|
|
1730
|
+
后端响应: syncResult.response
|
|
1727
1731
|
});
|
|
1728
|
-
_context25.next =
|
|
1732
|
+
_context25.next = 26;
|
|
1729
1733
|
break;
|
|
1730
|
-
case
|
|
1731
|
-
_context25.prev =
|
|
1734
|
+
case 21:
|
|
1735
|
+
_context25.prev = 21;
|
|
1732
1736
|
_context25.t0 = _context25["catch"](14);
|
|
1733
1737
|
console.error('[Checkout] EFTPOS 支付后订单同步失败:', _context25.t0);
|
|
1734
1738
|
// 不抛出错误,避免影响支付流程,但记录错误
|
|
1735
|
-
_context25.next =
|
|
1739
|
+
_context25.next = 26;
|
|
1736
1740
|
return this.handleError(new Error("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context25.t0 instanceof Error ? _context25.t0.message : String(_context25.t0))), CheckoutErrorType.OrderCreationFailed);
|
|
1737
|
-
case
|
|
1738
|
-
_context25.next =
|
|
1741
|
+
case 26:
|
|
1742
|
+
_context25.next = 28;
|
|
1739
1743
|
return this.updateStateAmountToRemaining();
|
|
1740
|
-
case
|
|
1741
|
-
_context25.next =
|
|
1744
|
+
case 28:
|
|
1745
|
+
_context25.next = 30;
|
|
1742
1746
|
return this.core.effects.emit(CheckoutHooks.OnPaymentStarted, {
|
|
1743
1747
|
orderUuid: this.store.currentOrder.uuid,
|
|
1744
1748
|
paymentMethodCode: paymentItem.code,
|
|
1745
1749
|
amount: String(paymentItem.amount),
|
|
1746
1750
|
timestamp: Date.now()
|
|
1747
1751
|
});
|
|
1748
|
-
case
|
|
1749
|
-
_context25.next =
|
|
1752
|
+
case 30:
|
|
1753
|
+
_context25.next = 38;
|
|
1750
1754
|
break;
|
|
1751
|
-
case
|
|
1752
|
-
_context25.prev =
|
|
1755
|
+
case 32:
|
|
1756
|
+
_context25.prev = 32;
|
|
1753
1757
|
_context25.t1 = _context25["catch"](0);
|
|
1754
1758
|
console.error('[Checkout] 添加支付项失败:', _context25.t1);
|
|
1755
|
-
_context25.next =
|
|
1759
|
+
_context25.next = 37;
|
|
1756
1760
|
return this.handleError(_context25.t1, CheckoutErrorType.PaymentFailed);
|
|
1757
|
-
case 36:
|
|
1758
|
-
throw _context25.t1;
|
|
1759
1761
|
case 37:
|
|
1762
|
+
throw _context25.t1;
|
|
1763
|
+
case 38:
|
|
1760
1764
|
case "end":
|
|
1761
1765
|
return _context25.stop();
|
|
1762
1766
|
}
|
|
1763
|
-
}, _callee25, this, [[0,
|
|
1767
|
+
}, _callee25, this, [[0, 32], [14, 21]]);
|
|
1764
1768
|
}));
|
|
1765
1769
|
function addPaymentItemAsync(_x16) {
|
|
1766
1770
|
return _addPaymentItemAsync.apply(this, arguments);
|
|
@@ -2270,7 +2274,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2270
2274
|
key: "manualSyncOrderAsync",
|
|
2271
2275
|
value: (function () {
|
|
2272
2276
|
var _manualSyncOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2273
|
-
var orderUuid, oldOrderId,
|
|
2277
|
+
var orderUuid, oldOrderId, syncResult, finalOrderId, finalIsVirtual, _this$store$currentOr8, errorMessage;
|
|
2274
2278
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2275
2279
|
while (1) switch (_context31.prev = _context31.next) {
|
|
2276
2280
|
case 0:
|
|
@@ -2307,11 +2311,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2307
2311
|
_context31.next = 17;
|
|
2308
2312
|
return this.syncOrderToBackendWithReturn(true);
|
|
2309
2313
|
case 17:
|
|
2310
|
-
|
|
2314
|
+
syncResult = _context31.sent;
|
|
2311
2315
|
console.log('[Checkout] 手动同步订单完成:', {
|
|
2312
2316
|
orderUuid: orderUuid,
|
|
2317
|
+
syncResult: syncResult,
|
|
2313
2318
|
oldOrderId: oldOrderId,
|
|
2314
|
-
realOrderId:
|
|
2319
|
+
realOrderId: syncResult.orderId,
|
|
2315
2320
|
isOrderSynced: this.store.isOrderSynced
|
|
2316
2321
|
});
|
|
2317
2322
|
|
|
@@ -2319,25 +2324,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2319
2324
|
finalOrderId = this.store.currentOrder.order_id;
|
|
2320
2325
|
finalIsVirtual = this.isVirtualOrderId(finalOrderId);
|
|
2321
2326
|
console.log('[Checkout] manualSyncOrderAsync 最终状态验证:', {
|
|
2322
|
-
返回的订单ID:
|
|
2327
|
+
返回的订单ID: syncResult.orderId,
|
|
2323
2328
|
存储的订单ID: finalOrderId,
|
|
2324
2329
|
存储的ID是否虚拟: finalIsVirtual,
|
|
2325
|
-
是否一致:
|
|
2330
|
+
是否一致: syncResult.orderId === finalOrderId,
|
|
2326
2331
|
同步状态: this.store.isOrderSynced
|
|
2327
2332
|
});
|
|
2328
2333
|
if (finalIsVirtual) {
|
|
2329
2334
|
console.error('[Checkout] 严重警告:手动同步完成后订单ID仍为虚拟ID!');
|
|
2330
2335
|
}
|
|
2331
|
-
if (
|
|
2336
|
+
if (syncResult.orderId !== finalOrderId) {
|
|
2332
2337
|
console.error('[Checkout] 严重警告:返回的订单ID与存储的订单ID不一致!');
|
|
2333
2338
|
}
|
|
2334
|
-
return _context31.abrupt("return",
|
|
2335
|
-
success: true,
|
|
2336
|
-
message: '订单同步成功',
|
|
2337
|
-
orderId: realOrderId,
|
|
2338
|
-
// 直接返回从后端获取的真实订单ID
|
|
2339
|
-
orderUuid: orderUuid
|
|
2340
|
-
});
|
|
2339
|
+
return _context31.abrupt("return", syncResult);
|
|
2341
2340
|
case 27:
|
|
2342
2341
|
_context31.prev = 27;
|
|
2343
2342
|
_context31.t6 = _context31["catch"](0);
|
|
@@ -2545,7 +2544,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2545
2544
|
key: "saveForLaterPaymentAsync",
|
|
2546
2545
|
value: (function () {
|
|
2547
2546
|
var _saveForLaterPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2548
|
-
var orderUuid, currentOrderId, allPaymentItems,
|
|
2547
|
+
var orderUuid, currentOrderId, allPaymentItems, syncResult, finalOrderId, _this$store$currentOr11, errorMessage;
|
|
2549
2548
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2550
2549
|
while (1) switch (_context33.prev = _context33.next) {
|
|
2551
2550
|
case 0:
|
|
@@ -2575,11 +2574,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2575
2574
|
_context33.next = 11;
|
|
2576
2575
|
return this.syncOrderToBackendWithReturn(false, allPaymentItems);
|
|
2577
2576
|
case 11:
|
|
2578
|
-
|
|
2577
|
+
syncResult = _context33.sent;
|
|
2579
2578
|
console.log('[Checkout] 保存订单完成:', {
|
|
2580
2579
|
orderUuid: orderUuid,
|
|
2581
2580
|
oldOrderId: currentOrderId,
|
|
2582
|
-
|
|
2581
|
+
syncResult: syncResult,
|
|
2582
|
+
realOrderId: syncResult.orderId,
|
|
2583
2583
|
isOrderSynced: this.store.isOrderSynced,
|
|
2584
2584
|
filteredPaymentsCount: allPaymentItems.length
|
|
2585
2585
|
});
|
|
@@ -2587,16 +2587,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2587
2587
|
// 验证最终状态
|
|
2588
2588
|
finalOrderId = this.store.currentOrder.order_id;
|
|
2589
2589
|
console.log('[Checkout] saveForLaterPaymentAsync 最终状态验证:', {
|
|
2590
|
-
返回的订单ID:
|
|
2590
|
+
返回的订单ID: syncResult.orderId,
|
|
2591
2591
|
存储的订单ID: finalOrderId,
|
|
2592
|
-
是否一致:
|
|
2592
|
+
是否一致: syncResult.orderId === finalOrderId,
|
|
2593
2593
|
同步状态: this.store.isOrderSynced
|
|
2594
2594
|
});
|
|
2595
2595
|
return _context33.abrupt("return", {
|
|
2596
2596
|
success: true,
|
|
2597
2597
|
message: '订单保存成功,可稍后继续支付',
|
|
2598
|
-
orderId:
|
|
2599
|
-
orderUuid: orderUuid
|
|
2598
|
+
orderId: syncResult.orderId,
|
|
2599
|
+
orderUuid: orderUuid,
|
|
2600
|
+
response: syncResult.response
|
|
2600
2601
|
});
|
|
2601
2602
|
case 18:
|
|
2602
2603
|
_context33.prev = 18;
|
|
@@ -3646,7 +3647,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3646
3647
|
*
|
|
3647
3648
|
* @param isManual 是否为手动同步,默认为 false
|
|
3648
3649
|
* @param customPaymentItems 自定义支付项列表,如果提供则使用此列表而不是从数据库获取
|
|
3649
|
-
* @returns
|
|
3650
|
+
* @returns 包含订单ID、UUID和完整后端响应的对象
|
|
3650
3651
|
*/
|
|
3651
3652
|
}, {
|
|
3652
3653
|
key: "syncOrderToBackendWithReturn",
|
|
@@ -3822,6 +3823,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3822
3823
|
deposit_amount: ((_this$store$currentOr21 = this.store.currentOrder) === null || _this$store$currentOr21 === void 0 ? void 0 : _this$store$currentOr21.deposit_amount) || '0.00',
|
|
3823
3824
|
// surcharge_fee: this.otherParams.surcharge_fee,
|
|
3824
3825
|
// surcharges: ,
|
|
3826
|
+
product_tax_fee: this.store.localOrderData.tax,
|
|
3825
3827
|
note: this.store.localOrderData.shop_note
|
|
3826
3828
|
// deposit_amount:
|
|
3827
3829
|
}); // 如果是更新操作,需要在参数中包含真实的订单ID
|
|
@@ -4049,8 +4051,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4049
4051
|
console.warn('[Checkout] 警告:订单创建后,当前订单ID仍然是虚拟ID,可能存在问题');
|
|
4050
4052
|
}
|
|
4051
4053
|
|
|
4052
|
-
//
|
|
4053
|
-
return _context47.abrupt("return",
|
|
4054
|
+
// 返回同步结果
|
|
4055
|
+
return _context47.abrupt("return", {
|
|
4056
|
+
success: true,
|
|
4057
|
+
message: "\u8BA2\u5355".concat(operation, "\u6210\u529F"),
|
|
4058
|
+
orderId: realOrderId,
|
|
4059
|
+
orderUuid: this.store.currentOrder.uuid,
|
|
4060
|
+
response: checkoutResponse
|
|
4061
|
+
});
|
|
4054
4062
|
case 91:
|
|
4055
4063
|
case "end":
|
|
4056
4064
|
return _context47.stop();
|
|
@@ -4066,6 +4074,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4066
4074
|
key: "syncOrderToBackend",
|
|
4067
4075
|
value: function () {
|
|
4068
4076
|
var _syncOrderToBackend = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
|
|
4077
|
+
var syncResult;
|
|
4069
4078
|
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
|
4070
4079
|
while (1) switch (_context48.prev = _context48.next) {
|
|
4071
4080
|
case 0:
|
|
@@ -4073,19 +4082,21 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4073
4082
|
_context48.next = 3;
|
|
4074
4083
|
return this.syncOrderToBackendWithReturn(false);
|
|
4075
4084
|
case 3:
|
|
4076
|
-
|
|
4085
|
+
syncResult = _context48.sent;
|
|
4086
|
+
console.log('[Checkout] 自动同步订单完成:', syncResult);
|
|
4087
|
+
_context48.next = 12;
|
|
4077
4088
|
break;
|
|
4078
|
-
case
|
|
4079
|
-
_context48.prev =
|
|
4089
|
+
case 7:
|
|
4090
|
+
_context48.prev = 7;
|
|
4080
4091
|
_context48.t0 = _context48["catch"](0);
|
|
4081
4092
|
console.error('[Checkout] 同步订单到后端失败:', _context48.t0);
|
|
4082
|
-
_context48.next =
|
|
4093
|
+
_context48.next = 12;
|
|
4083
4094
|
return this.handleError(new Error("\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context48.t0 instanceof Error ? _context48.t0.message : String(_context48.t0))), CheckoutErrorType.OrderCreationFailed);
|
|
4084
|
-
case
|
|
4095
|
+
case 12:
|
|
4085
4096
|
case "end":
|
|
4086
4097
|
return _context48.stop();
|
|
4087
4098
|
}
|
|
4088
|
-
}, _callee48, this, [[0,
|
|
4099
|
+
}, _callee48, this, [[0, 7]]);
|
|
4089
4100
|
}));
|
|
4090
4101
|
function syncOrderToBackend() {
|
|
4091
4102
|
return _syncOrderToBackend.apply(this, arguments);
|
|
@@ -172,6 +172,8 @@ export interface LocalOrderData {
|
|
|
172
172
|
surcharges?: any[];
|
|
173
173
|
/** 商店折扣金额 */
|
|
174
174
|
shop_discount?: number;
|
|
175
|
+
/** 税费金额 */
|
|
176
|
+
tax?: number;
|
|
175
177
|
}
|
|
176
178
|
/**
|
|
177
179
|
* 本地预订项
|
|
@@ -632,6 +634,7 @@ export interface CheckoutModuleAPI extends Module {
|
|
|
632
634
|
message?: string;
|
|
633
635
|
orderId?: string;
|
|
634
636
|
orderUuid?: string;
|
|
637
|
+
response?: any;
|
|
635
638
|
}>;
|
|
636
639
|
/**
|
|
637
640
|
* 检查订单是否需要手动同步(异步版本)
|
|
@@ -704,6 +707,7 @@ export interface CheckoutModuleAPI extends Module {
|
|
|
704
707
|
message?: string;
|
|
705
708
|
orderId?: string;
|
|
706
709
|
orderUuid?: string;
|
|
710
|
+
response?: any;
|
|
707
711
|
}>;
|
|
708
712
|
/**
|
|
709
713
|
* 通过订单ID编辑订单备注
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -314,7 +314,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
314
314
|
}[];
|
|
315
315
|
setOtherData(key: string, value: any): void;
|
|
316
316
|
getOtherData(key: string): any;
|
|
317
|
-
getProductTypeById(id: number): Promise<"
|
|
317
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
318
318
|
/**
|
|
319
319
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
320
320
|
*
|
|
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
111
111
|
* 获取当前的客户搜索条件
|
|
112
112
|
* @returns 当前搜索条件
|
|
113
113
|
*/
|
|
114
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -276,6 +276,7 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
276
276
|
message?: string;
|
|
277
277
|
orderId?: string;
|
|
278
278
|
orderUuid?: string;
|
|
279
|
+
response?: any;
|
|
279
280
|
}>;
|
|
280
281
|
/**
|
|
281
282
|
* 获取当前订单备注
|
|
@@ -319,6 +320,7 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
319
320
|
message?: string;
|
|
320
321
|
orderId?: string;
|
|
321
322
|
orderUuid?: string;
|
|
323
|
+
response?: any;
|
|
322
324
|
}>;
|
|
323
325
|
/**
|
|
324
326
|
* 获取当前商店折扣金额
|
|
@@ -440,7 +442,7 @@ export declare class CheckoutImpl extends BaseModule implements Module, Checkout
|
|
|
440
442
|
*
|
|
441
443
|
* @param isManual 是否为手动同步,默认为 false
|
|
442
444
|
* @param customPaymentItems 自定义支付项列表,如果提供则使用此列表而不是从数据库获取
|
|
443
|
-
* @returns
|
|
445
|
+
* @returns 包含订单ID、UUID和完整后端响应的对象
|
|
444
446
|
*/
|
|
445
447
|
private syncOrderToBackendWithReturn;
|
|
446
448
|
private syncOrderToBackend;
|
|
@@ -200,7 +200,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
200
200
|
* 方法会记录参数并创建本地虚拟订单,然后用 Payment 模块管理支付流程。
|
|
201
201
|
*/
|
|
202
202
|
async createLocalOrderAsync(params) {
|
|
203
|
-
var _a, _b, _c, _d, _e, _f;
|
|
203
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
204
204
|
try {
|
|
205
205
|
await this.resetStoreStateAsync();
|
|
206
206
|
await this.setStatus(import_types.CheckoutStatus.CreatingOrder);
|
|
@@ -218,6 +218,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
218
218
|
params.orderData.surcharge_fee = (_b = (_a = params.totalInfo) == null ? void 0 : _a.total) == null ? void 0 : _b.otherAmount;
|
|
219
219
|
params.orderData.surcharges = (_d = (_c = params.totalInfo) == null ? void 0 : _c.total) == null ? void 0 : _d.surcharge;
|
|
220
220
|
params.orderData.shop_discount = (_f = (_e = params.totalInfo) == null ? void 0 : _e.total) == null ? void 0 : _f.shopDiscount;
|
|
221
|
+
params.orderData.tax = (_h = (_g = params.totalInfo) == null ? void 0 : _g.total) == null ? void 0 : _h.tax;
|
|
221
222
|
this.store.localOrderData = params.orderData;
|
|
222
223
|
this.store.cartSummary = params.cartSummary;
|
|
223
224
|
const customerInfo = {
|
|
@@ -981,10 +982,11 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
981
982
|
if (isEftposPayment) {
|
|
982
983
|
console.log("[Checkout] 检测到 EFTPOS 支付,立即同步订单到后端...");
|
|
983
984
|
try {
|
|
984
|
-
await this.syncOrderToBackendWithReturn(true);
|
|
985
|
+
const syncResult = await this.syncOrderToBackendWithReturn(true);
|
|
985
986
|
console.log("[Checkout] EFTPOS 支付后订单同步完成 (已标记为手动同步):", {
|
|
986
|
-
订单ID:
|
|
987
|
-
是否已同步: this.store.isOrderSynced
|
|
987
|
+
订单ID: syncResult.orderId,
|
|
988
|
+
是否已同步: this.store.isOrderSynced,
|
|
989
|
+
后端响应: syncResult.response
|
|
988
990
|
});
|
|
989
991
|
} catch (error) {
|
|
990
992
|
console.error("[Checkout] EFTPOS 支付后订单同步失败:", error);
|
|
@@ -1376,37 +1378,32 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1376
1378
|
totalAmount: this.store.currentOrder.total_amount,
|
|
1377
1379
|
remainingAmount: await this.calculateRemainingAmountAsync()
|
|
1378
1380
|
});
|
|
1379
|
-
const
|
|
1381
|
+
const syncResult = await this.syncOrderToBackendWithReturn(true);
|
|
1380
1382
|
console.log("[Checkout] 手动同步订单完成:", {
|
|
1381
1383
|
orderUuid,
|
|
1384
|
+
syncResult,
|
|
1382
1385
|
oldOrderId,
|
|
1383
|
-
realOrderId,
|
|
1386
|
+
realOrderId: syncResult.orderId,
|
|
1384
1387
|
isOrderSynced: this.store.isOrderSynced
|
|
1385
1388
|
});
|
|
1386
1389
|
const finalOrderId = this.store.currentOrder.order_id;
|
|
1387
1390
|
const finalIsVirtual = this.isVirtualOrderId(finalOrderId);
|
|
1388
1391
|
console.log("[Checkout] manualSyncOrderAsync 最终状态验证:", {
|
|
1389
|
-
返回的订单ID:
|
|
1392
|
+
返回的订单ID: syncResult.orderId,
|
|
1390
1393
|
存储的订单ID: finalOrderId,
|
|
1391
1394
|
存储的ID是否虚拟: finalIsVirtual,
|
|
1392
|
-
是否一致:
|
|
1395
|
+
是否一致: syncResult.orderId === finalOrderId,
|
|
1393
1396
|
同步状态: this.store.isOrderSynced
|
|
1394
1397
|
});
|
|
1395
1398
|
if (finalIsVirtual) {
|
|
1396
1399
|
console.error("[Checkout] 严重警告:手动同步完成后订单ID仍为虚拟ID!");
|
|
1397
1400
|
}
|
|
1398
|
-
if (
|
|
1401
|
+
if (syncResult.orderId !== finalOrderId) {
|
|
1399
1402
|
console.error(
|
|
1400
1403
|
"[Checkout] 严重警告:返回的订单ID与存储的订单ID不一致!"
|
|
1401
1404
|
);
|
|
1402
1405
|
}
|
|
1403
|
-
return
|
|
1404
|
-
success: true,
|
|
1405
|
-
message: "订单同步成功",
|
|
1406
|
-
orderId: realOrderId,
|
|
1407
|
-
// 直接返回从后端获取的真实订单ID
|
|
1408
|
-
orderUuid
|
|
1409
|
-
};
|
|
1406
|
+
return syncResult;
|
|
1410
1407
|
} catch (error) {
|
|
1411
1408
|
console.error("[Checkout] 手动同步订单失败:", error);
|
|
1412
1409
|
const errorMessage = error instanceof Error ? error.message : "同步失败";
|
|
@@ -1566,29 +1563,31 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1566
1563
|
const allPaymentItems = await this.payment.getPaymentItemsAsync(
|
|
1567
1564
|
this.store.currentOrder.uuid
|
|
1568
1565
|
);
|
|
1569
|
-
const
|
|
1566
|
+
const syncResult = await this.syncOrderToBackendWithReturn(
|
|
1570
1567
|
false,
|
|
1571
1568
|
allPaymentItems
|
|
1572
1569
|
);
|
|
1573
1570
|
console.log("[Checkout] 保存订单完成:", {
|
|
1574
1571
|
orderUuid,
|
|
1575
1572
|
oldOrderId: currentOrderId,
|
|
1576
|
-
|
|
1573
|
+
syncResult,
|
|
1574
|
+
realOrderId: syncResult.orderId,
|
|
1577
1575
|
isOrderSynced: this.store.isOrderSynced,
|
|
1578
1576
|
filteredPaymentsCount: allPaymentItems.length
|
|
1579
1577
|
});
|
|
1580
1578
|
const finalOrderId = this.store.currentOrder.order_id;
|
|
1581
1579
|
console.log("[Checkout] saveForLaterPaymentAsync 最终状态验证:", {
|
|
1582
|
-
返回的订单ID:
|
|
1580
|
+
返回的订单ID: syncResult.orderId,
|
|
1583
1581
|
存储的订单ID: finalOrderId,
|
|
1584
|
-
是否一致:
|
|
1582
|
+
是否一致: syncResult.orderId === finalOrderId,
|
|
1585
1583
|
同步状态: this.store.isOrderSynced
|
|
1586
1584
|
});
|
|
1587
1585
|
return {
|
|
1588
1586
|
success: true,
|
|
1589
1587
|
message: "订单保存成功,可稍后继续支付",
|
|
1590
|
-
orderId:
|
|
1591
|
-
orderUuid
|
|
1588
|
+
orderId: syncResult.orderId,
|
|
1589
|
+
orderUuid,
|
|
1590
|
+
response: syncResult.response
|
|
1592
1591
|
};
|
|
1593
1592
|
} catch (error) {
|
|
1594
1593
|
console.error("[Checkout] 保存订单失败:", error);
|
|
@@ -2211,7 +2210,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2211
2210
|
*
|
|
2212
2211
|
* @param isManual 是否为手动同步,默认为 false
|
|
2213
2212
|
* @param customPaymentItems 自定义支付项列表,如果提供则使用此列表而不是从数据库获取
|
|
2214
|
-
* @returns
|
|
2213
|
+
* @returns 包含订单ID、UUID和完整后端响应的对象
|
|
2215
2214
|
*/
|
|
2216
2215
|
async syncOrderToBackendWithReturn(isManual = false, customPaymentItems) {
|
|
2217
2216
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -2312,6 +2311,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2312
2311
|
deposit_amount: ((_d = this.store.currentOrder) == null ? void 0 : _d.deposit_amount) || "0.00",
|
|
2313
2312
|
// surcharge_fee: this.otherParams.surcharge_fee,
|
|
2314
2313
|
// surcharges: ,
|
|
2314
|
+
product_tax_fee: this.store.localOrderData.tax,
|
|
2315
2315
|
note: this.store.localOrderData.shop_note
|
|
2316
2316
|
// deposit_amount:
|
|
2317
2317
|
};
|
|
@@ -2490,11 +2490,18 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2490
2490
|
"[Checkout] 警告:订单创建后,当前订单ID仍然是虚拟ID,可能存在问题"
|
|
2491
2491
|
);
|
|
2492
2492
|
}
|
|
2493
|
-
return
|
|
2493
|
+
return {
|
|
2494
|
+
success: true,
|
|
2495
|
+
message: `订单${operation}成功`,
|
|
2496
|
+
orderId: realOrderId,
|
|
2497
|
+
orderUuid: this.store.currentOrder.uuid,
|
|
2498
|
+
response: checkoutResponse
|
|
2499
|
+
};
|
|
2494
2500
|
}
|
|
2495
2501
|
async syncOrderToBackend() {
|
|
2496
2502
|
try {
|
|
2497
|
-
await this.syncOrderToBackendWithReturn(false);
|
|
2503
|
+
const syncResult = await this.syncOrderToBackendWithReturn(false);
|
|
2504
|
+
console.log("[Checkout] 自动同步订单完成:", syncResult);
|
|
2498
2505
|
} catch (error) {
|
|
2499
2506
|
console.error("[Checkout] 同步订单到后端失败:", error);
|
|
2500
2507
|
await this.handleError(
|
|
@@ -172,6 +172,8 @@ export interface LocalOrderData {
|
|
|
172
172
|
surcharges?: any[];
|
|
173
173
|
/** 商店折扣金额 */
|
|
174
174
|
shop_discount?: number;
|
|
175
|
+
/** 税费金额 */
|
|
176
|
+
tax?: number;
|
|
175
177
|
}
|
|
176
178
|
/**
|
|
177
179
|
* 本地预订项
|
|
@@ -632,6 +634,7 @@ export interface CheckoutModuleAPI extends Module {
|
|
|
632
634
|
message?: string;
|
|
633
635
|
orderId?: string;
|
|
634
636
|
orderUuid?: string;
|
|
637
|
+
response?: any;
|
|
635
638
|
}>;
|
|
636
639
|
/**
|
|
637
640
|
* 检查订单是否需要手动同步(异步版本)
|
|
@@ -704,6 +707,7 @@ export interface CheckoutModuleAPI extends Module {
|
|
|
704
707
|
message?: string;
|
|
705
708
|
orderId?: string;
|
|
706
709
|
orderUuid?: string;
|
|
710
|
+
response?: any;
|
|
707
711
|
}>;
|
|
708
712
|
/**
|
|
709
713
|
* 通过订单ID编辑订单备注
|