@pisell/pisellos 0.0.567 → 0.0.568
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/core/index.js +6 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +0 -3
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +0 -1
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.js +1 -4
- package/dist/modules/OpenData/index.js +0 -2
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +14 -41
- package/dist/modules/Payment/index.js +142 -270
- package/dist/modules/Payment/walletpass.js +4 -5
- package/dist/modules/Rules/index.js +0 -7
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.js +88 -121
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/products/index.js +29 -49
- package/dist/server/modules/quotation/index.js +29 -38
- package/dist/server/modules/resource/index.js +3 -4
- package/dist/server/modules/schedule/index.js +32 -40
- package/dist/server/utils/product.js +0 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +5 -7
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +25 -31
- package/dist/solution/BookingTicket/utils/scan/index.js +6 -10
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.js +177 -246
- package/dist/solution/Checkout/utils/index.js +4 -16
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/ScanOrder/index.js +50 -60
- package/dist/solution/ShopDiscount/index.js +2 -7
- package/dist/solution/VenueBooking/index.d.ts +5 -0
- package/dist/solution/VenueBooking/index.js +364 -327
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +381 -231
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +652 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.js +22 -45
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +306 -241
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +26 -62
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.js +216 -153
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.js +117 -113
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.js +63 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +332 -320
- package/lib/modules/Order/types.js +24 -33
- package/lib/modules/Order/utils.js +350 -284
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.js +566 -432
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.js +50 -47
- package/lib/modules/Payment/walletpass.js +221 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.js +111 -110
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.js +60 -82
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/Rules/index.js +1172 -872
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.js +59 -68
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.js +176 -193
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +334 -167
- package/lib/modules/Schedule/index.js +97 -107
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/index.js +212 -57
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.js +882 -623
- package/lib/server/modules/index.js +85 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.js +195 -231
- package/lib/server/modules/order/types.js +107 -32
- package/lib/server/modules/order/utils/filterBookings.js +174 -140
- package/lib/server/modules/order/utils/filterOrders.js +89 -60
- package/lib/server/modules/products/index.js +430 -335
- package/lib/server/modules/products/types.js +41 -34
- package/lib/server/modules/quotation/index.js +76 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.js +216 -187
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.js +134 -119
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +196 -139
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +147 -122
- package/lib/solution/BookingTicket/types.js +38 -64
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +64 -80
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +82 -80
- package/lib/solution/BookingTicket/utils/scan/index.js +90 -94
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.js +1451 -1158
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +227 -158
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +493 -460
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.js +218 -200
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.js +803 -840
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.js +372 -331
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/VenueBooking/index.d.ts +5 -0
- package/lib/solution/VenueBooking/index.js +886 -929
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.js +88 -106
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.js +102 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
|
@@ -198,9 +198,8 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
198
198
|
// // 预连接数据库
|
|
199
199
|
// this.dbManager.connect()
|
|
200
200
|
|
|
201
|
-
console.log('[PaymentModule] 初始化完成');
|
|
202
201
|
this.logInfo('PaymentModule initialized successfully');
|
|
203
|
-
case
|
|
202
|
+
case 17:
|
|
204
203
|
case "end":
|
|
205
204
|
return _context.stop();
|
|
206
205
|
}
|
|
@@ -301,7 +300,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
301
300
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
302
301
|
while (1) switch (_context2.prev = _context2.next) {
|
|
303
302
|
case 0:
|
|
304
|
-
console.log('网络状态:', status.connected);
|
|
305
303
|
_this3.logInfo('Network status changed', {
|
|
306
304
|
connected: status.connected,
|
|
307
305
|
previousStatus: status.previousStatus
|
|
@@ -310,7 +308,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
310
308
|
_this3.logInfo('Network reconnected');
|
|
311
309
|
// 网络恢复时的处理逻辑可以在这里添加
|
|
312
310
|
}
|
|
313
|
-
case
|
|
311
|
+
case 2:
|
|
314
312
|
case "end":
|
|
315
313
|
return _context2.stop();
|
|
316
314
|
}
|
|
@@ -479,113 +477,107 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
479
477
|
cachedMethodsCount: cachedMethods.length
|
|
480
478
|
});
|
|
481
479
|
_context5.prev = 1;
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
// 从服务器获取最新数据
|
|
485
|
-
_context5.next = 5;
|
|
480
|
+
_context5.next = 4;
|
|
486
481
|
return this.request.get('/pay/custom-payment/all');
|
|
487
|
-
case
|
|
482
|
+
case 4:
|
|
488
483
|
response = _context5.sent;
|
|
489
484
|
response.data = this.filterPayMethods(response.data);
|
|
490
485
|
newPayMethods = response.data || []; // 检查是否有变化
|
|
491
486
|
hasChanges = this.hasPaymentMethodsChanged(cachedMethods, newPayMethods);
|
|
492
487
|
if (!hasChanges) {
|
|
493
|
-
_context5.next =
|
|
488
|
+
_context5.next = 55;
|
|
494
489
|
break;
|
|
495
490
|
}
|
|
496
|
-
console.log('[PaymentModule] 支付方式列表已更新');
|
|
497
491
|
this.logInfo('Payment methods updated in background', {
|
|
498
492
|
oldCount: cachedMethods.length,
|
|
499
493
|
newCount: newPayMethods.length
|
|
500
494
|
});
|
|
501
495
|
|
|
502
496
|
// 更新缓存
|
|
503
|
-
_context5.prev =
|
|
497
|
+
_context5.prev = 10;
|
|
504
498
|
// 先清除旧数据
|
|
505
499
|
_iterator3 = _createForOfIteratorHelper(cachedMethods);
|
|
506
|
-
_context5.prev =
|
|
500
|
+
_context5.prev = 12;
|
|
507
501
|
_iterator3.s();
|
|
508
|
-
case
|
|
502
|
+
case 14:
|
|
509
503
|
if ((_step3 = _iterator3.n()).done) {
|
|
510
|
-
_context5.next =
|
|
504
|
+
_context5.next = 20;
|
|
511
505
|
break;
|
|
512
506
|
}
|
|
513
507
|
method = _step3.value;
|
|
514
|
-
_context5.next =
|
|
508
|
+
_context5.next = 18;
|
|
515
509
|
return this.dbManager.delete('pay_method', method.id);
|
|
510
|
+
case 18:
|
|
511
|
+
_context5.next = 14;
|
|
512
|
+
break;
|
|
516
513
|
case 20:
|
|
517
|
-
_context5.next =
|
|
514
|
+
_context5.next = 25;
|
|
518
515
|
break;
|
|
519
516
|
case 22:
|
|
520
|
-
_context5.
|
|
521
|
-
|
|
522
|
-
case 24:
|
|
523
|
-
_context5.prev = 24;
|
|
524
|
-
_context5.t0 = _context5["catch"](14);
|
|
517
|
+
_context5.prev = 22;
|
|
518
|
+
_context5.t0 = _context5["catch"](12);
|
|
525
519
|
_iterator3.e(_context5.t0);
|
|
526
|
-
case
|
|
527
|
-
_context5.prev =
|
|
520
|
+
case 25:
|
|
521
|
+
_context5.prev = 25;
|
|
528
522
|
_iterator3.f();
|
|
529
|
-
return _context5.finish(
|
|
530
|
-
case
|
|
523
|
+
return _context5.finish(25);
|
|
524
|
+
case 28:
|
|
531
525
|
// 添加新数据
|
|
532
526
|
_iterator4 = _createForOfIteratorHelper(newPayMethods);
|
|
533
|
-
_context5.prev =
|
|
527
|
+
_context5.prev = 29;
|
|
534
528
|
_iterator4.s();
|
|
535
|
-
case
|
|
529
|
+
case 31:
|
|
536
530
|
if ((_step4 = _iterator4.n()).done) {
|
|
537
|
-
_context5.next =
|
|
531
|
+
_context5.next = 37;
|
|
538
532
|
break;
|
|
539
533
|
}
|
|
540
534
|
_method = _step4.value;
|
|
541
|
-
_context5.next =
|
|
535
|
+
_context5.next = 35;
|
|
542
536
|
return this.dbManager.update('pay_method', _method);
|
|
537
|
+
case 35:
|
|
538
|
+
_context5.next = 31;
|
|
539
|
+
break;
|
|
543
540
|
case 37:
|
|
544
|
-
_context5.next =
|
|
541
|
+
_context5.next = 42;
|
|
545
542
|
break;
|
|
546
543
|
case 39:
|
|
547
|
-
_context5.
|
|
548
|
-
|
|
549
|
-
case 41:
|
|
550
|
-
_context5.prev = 41;
|
|
551
|
-
_context5.t1 = _context5["catch"](31);
|
|
544
|
+
_context5.prev = 39;
|
|
545
|
+
_context5.t1 = _context5["catch"](29);
|
|
552
546
|
_iterator4.e(_context5.t1);
|
|
553
|
-
case
|
|
554
|
-
_context5.prev =
|
|
547
|
+
case 42:
|
|
548
|
+
_context5.prev = 42;
|
|
555
549
|
_iterator4.f();
|
|
556
|
-
return _context5.finish(
|
|
557
|
-
case
|
|
558
|
-
_context5.next =
|
|
550
|
+
return _context5.finish(42);
|
|
551
|
+
case 45:
|
|
552
|
+
_context5.next = 50;
|
|
559
553
|
break;
|
|
560
|
-
case
|
|
561
|
-
_context5.prev =
|
|
562
|
-
_context5.t2 = _context5["catch"](
|
|
554
|
+
case 47:
|
|
555
|
+
_context5.prev = 47;
|
|
556
|
+
_context5.t2 = _context5["catch"](10);
|
|
563
557
|
console.warn('[PaymentModule] 无法更新支付方式缓存', _context5.t2);
|
|
564
|
-
case
|
|
558
|
+
case 50:
|
|
565
559
|
// 通知外部支付方式已变化
|
|
566
560
|
eventData = {
|
|
567
561
|
oldMethods: cachedMethods,
|
|
568
562
|
newMethods: newPayMethods
|
|
569
563
|
};
|
|
570
|
-
_context5.next =
|
|
564
|
+
_context5.next = 53;
|
|
571
565
|
return this.core.effects.emit("".concat(this.name, ":onPaymentMethodsChanged"), eventData);
|
|
566
|
+
case 53:
|
|
567
|
+
_context5.next = 55;
|
|
568
|
+
break;
|
|
572
569
|
case 55:
|
|
573
|
-
_context5.next =
|
|
570
|
+
_context5.next = 60;
|
|
574
571
|
break;
|
|
575
572
|
case 57:
|
|
576
|
-
|
|
577
|
-
case 58:
|
|
578
|
-
_context5.next = 63;
|
|
579
|
-
break;
|
|
580
|
-
case 60:
|
|
581
|
-
_context5.prev = 60;
|
|
573
|
+
_context5.prev = 57;
|
|
582
574
|
_context5.t3 = _context5["catch"](1);
|
|
583
575
|
console.error('[PaymentModule] 后台刷新支付方式失败', _context5.t3);
|
|
584
|
-
case
|
|
576
|
+
case 60:
|
|
585
577
|
case "end":
|
|
586
578
|
return _context5.stop();
|
|
587
579
|
}
|
|
588
|
-
}, _callee5, this, [[1,
|
|
580
|
+
}, _callee5, this, [[1, 57], [10, 47], [12, 22, 25, 28], [29, 39, 42, 45]]);
|
|
589
581
|
}));
|
|
590
582
|
function refreshPaymentMethodsInBackground(_x5) {
|
|
591
583
|
return _refreshPaymentMethodsInBackground.apply(this, arguments);
|
|
@@ -621,63 +613,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
621
613
|
|
|
622
614
|
// 检查关键字段是否有变化
|
|
623
615
|
if (oldMethod.code !== newMethod.code || oldMethod.name !== newMethod.name || oldMethod.type !== newMethod.type || oldMethod.description !== newMethod.description || oldMethod.status !== newMethod.status || oldMethod.disable !== newMethod.disable || oldMethod.is_surcharge !== newMethod.is_surcharge || oldMethod.fixed !== newMethod.fixed || oldMethod.percentage !== newMethod.percentage || oldMethod.enabled !== newMethod.enabled || JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) || JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) || JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {})) {
|
|
624
|
-
console.log("[PaymentModule] \u652F\u4ED8\u65B9\u5F0F ".concat(newMethod.id, " (").concat(newMethod.code, ") \u53D1\u751F\u53D8\u5316:"), {
|
|
625
|
-
id: newMethod.id,
|
|
626
|
-
changes: {
|
|
627
|
-
code: oldMethod.code !== newMethod.code ? {
|
|
628
|
-
old: oldMethod.code,
|
|
629
|
-
new: newMethod.code
|
|
630
|
-
} : undefined,
|
|
631
|
-
name: oldMethod.name !== newMethod.name ? {
|
|
632
|
-
old: oldMethod.name,
|
|
633
|
-
new: newMethod.name
|
|
634
|
-
} : undefined,
|
|
635
|
-
type: oldMethod.type !== newMethod.type ? {
|
|
636
|
-
old: oldMethod.type,
|
|
637
|
-
new: newMethod.type
|
|
638
|
-
} : undefined,
|
|
639
|
-
description: oldMethod.description !== newMethod.description ? {
|
|
640
|
-
old: oldMethod.description,
|
|
641
|
-
new: newMethod.description
|
|
642
|
-
} : undefined,
|
|
643
|
-
status: oldMethod.status !== newMethod.status ? {
|
|
644
|
-
old: oldMethod.status,
|
|
645
|
-
new: newMethod.status
|
|
646
|
-
} : undefined,
|
|
647
|
-
disable: oldMethod.disable !== newMethod.disable ? {
|
|
648
|
-
old: oldMethod.disable,
|
|
649
|
-
new: newMethod.disable
|
|
650
|
-
} : undefined,
|
|
651
|
-
is_surcharge: oldMethod.is_surcharge !== newMethod.is_surcharge ? {
|
|
652
|
-
old: oldMethod.is_surcharge,
|
|
653
|
-
new: newMethod.is_surcharge
|
|
654
|
-
} : undefined,
|
|
655
|
-
fixed: oldMethod.fixed !== newMethod.fixed ? {
|
|
656
|
-
old: oldMethod.fixed,
|
|
657
|
-
new: newMethod.fixed
|
|
658
|
-
} : undefined,
|
|
659
|
-
percentage: oldMethod.percentage !== newMethod.percentage ? {
|
|
660
|
-
old: oldMethod.percentage,
|
|
661
|
-
new: newMethod.percentage
|
|
662
|
-
} : undefined,
|
|
663
|
-
enabled: oldMethod.enabled !== newMethod.enabled ? {
|
|
664
|
-
old: oldMethod.enabled,
|
|
665
|
-
new: newMethod.enabled
|
|
666
|
-
} : undefined,
|
|
667
|
-
channel_application: JSON.stringify(oldMethod.channel_application || []) !== JSON.stringify(newMethod.channel_application || []) ? {
|
|
668
|
-
old: oldMethod.channel_application,
|
|
669
|
-
new: newMethod.channel_application
|
|
670
|
-
} : undefined,
|
|
671
|
-
companies: JSON.stringify(oldMethod.companies || []) !== JSON.stringify(newMethod.companies || []) ? {
|
|
672
|
-
old: oldMethod.companies,
|
|
673
|
-
new: newMethod.companies
|
|
674
|
-
} : undefined,
|
|
675
|
-
metadata: JSON.stringify(oldMethod.metadata || {}) !== JSON.stringify(newMethod.metadata || {}) ? {
|
|
676
|
-
old: oldMethod.metadata,
|
|
677
|
-
new: newMethod.metadata
|
|
678
|
-
} : undefined
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
616
|
return true; // 方法属性有变化
|
|
682
617
|
}
|
|
683
618
|
}
|
|
@@ -908,7 +843,7 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
908
843
|
case 3:
|
|
909
844
|
order = _context9.sent;
|
|
910
845
|
if (!order) {
|
|
911
|
-
_context9.next =
|
|
846
|
+
_context9.next = 9;
|
|
912
847
|
break;
|
|
913
848
|
}
|
|
914
849
|
_context9.next = 7;
|
|
@@ -917,20 +852,18 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
917
852
|
_context9.next = 9;
|
|
918
853
|
return this.core.effects.emit("".concat(this.name, ":onOrderDeleted"), order);
|
|
919
854
|
case 9:
|
|
920
|
-
|
|
921
|
-
case 10:
|
|
922
|
-
_context9.next = 16;
|
|
855
|
+
_context9.next = 15;
|
|
923
856
|
break;
|
|
924
|
-
case
|
|
925
|
-
_context9.prev =
|
|
857
|
+
case 11:
|
|
858
|
+
_context9.prev = 11;
|
|
926
859
|
_context9.t0 = _context9["catch"](0);
|
|
927
860
|
console.error('[PaymentModule] 删除支付订单失败', _context9.t0);
|
|
928
861
|
throw _context9.t0;
|
|
929
|
-
case
|
|
862
|
+
case 15:
|
|
930
863
|
case "end":
|
|
931
864
|
return _context9.stop();
|
|
932
865
|
}
|
|
933
|
-
}, _callee9, this, [[0,
|
|
866
|
+
}, _callee9, this, [[0, 11]]);
|
|
934
867
|
}));
|
|
935
868
|
function deletePaymentOrderAsync(_x8) {
|
|
936
869
|
return _deletePaymentOrderAsync.apply(this, arguments);
|
|
@@ -1080,10 +1013,9 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1080
1013
|
originalOrderId: originalOrderId,
|
|
1081
1014
|
newOrderId: newOrderId
|
|
1082
1015
|
});
|
|
1083
|
-
console.log("[PaymentModule] \u8BA2\u5355ID\u66FF\u6362\u6210\u529F: ".concat(originalOrderId, " \u2192 ").concat(newOrderId));
|
|
1084
1016
|
return _context11.abrupt("return", updatedOrder);
|
|
1085
|
-
case
|
|
1086
|
-
_context11.prev =
|
|
1017
|
+
case 27:
|
|
1018
|
+
_context11.prev = 27;
|
|
1087
1019
|
_context11.t0 = _context11["catch"](1);
|
|
1088
1020
|
console.error('[PaymentModule] 替换订单ID失败', _context11.t0);
|
|
1089
1021
|
this.logError('replaceOrderIdByUuidAsync failed', _context11.t0, {
|
|
@@ -1091,11 +1023,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1091
1023
|
newOrderId: newOrderId
|
|
1092
1024
|
});
|
|
1093
1025
|
throw _context11.t0;
|
|
1094
|
-
case
|
|
1026
|
+
case 32:
|
|
1095
1027
|
case "end":
|
|
1096
1028
|
return _context11.stop();
|
|
1097
1029
|
}
|
|
1098
|
-
}, _callee11, this, [[1,
|
|
1030
|
+
}, _callee11, this, [[1, 27]]);
|
|
1099
1031
|
}));
|
|
1100
1032
|
function replaceOrderIdByUuidAsync(_x11, _x12) {
|
|
1101
1033
|
return _replaceOrderIdByUuidAsync.apply(this, arguments);
|
|
@@ -1373,42 +1305,36 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1373
1305
|
paymentItem.origin_amount = paymentItem.amount; // 保存原始金额
|
|
1374
1306
|
paymentItem.amount = '0.00'; // 将金额设为0,不参与订单金额计算
|
|
1375
1307
|
|
|
1376
|
-
console.log("[PaymentModule] \u652F\u4ED8\u9879\u6807\u8BB0\u4E3A\u5220\u9664:", {
|
|
1377
|
-
uuid: paymentItem.uuid,
|
|
1378
|
-
originalAmount: paymentItem.origin_amount,
|
|
1379
|
-
status: paymentItem.status
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
1308
|
// 重新计算待付金额
|
|
1383
1309
|
this.recalculateOrderAmount(order);
|
|
1384
1310
|
|
|
1385
1311
|
// 更新到 IndexDB
|
|
1386
|
-
_context15.next =
|
|
1312
|
+
_context15.next = 19;
|
|
1387
1313
|
return this.dbManager.update('order', order);
|
|
1388
|
-
case
|
|
1389
|
-
_context15.next =
|
|
1314
|
+
case 19:
|
|
1315
|
+
_context15.next = 21;
|
|
1390
1316
|
return this.core.effects.emit("".concat(this.name, ":onPaymentDeleted"), {
|
|
1391
1317
|
order: order,
|
|
1392
1318
|
paymentItem: paymentItem
|
|
1393
1319
|
});
|
|
1394
|
-
case
|
|
1395
|
-
_context15.next =
|
|
1320
|
+
case 21:
|
|
1321
|
+
_context15.next = 23;
|
|
1396
1322
|
return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
|
|
1397
1323
|
action: 'payment_delete',
|
|
1398
1324
|
order: order,
|
|
1399
1325
|
paymentItem: paymentItem
|
|
1400
1326
|
});
|
|
1401
|
-
case
|
|
1327
|
+
case 23:
|
|
1402
1328
|
this.logInfo('deletePaymentAsync completed successfully (marked as voided)', {
|
|
1403
1329
|
orderUuid: orderUuid,
|
|
1404
1330
|
paymentUuid: paymentUuid,
|
|
1405
1331
|
originalAmount: paymentItem.origin_amount,
|
|
1406
1332
|
newExpectAmount: order.expect_amount
|
|
1407
1333
|
});
|
|
1408
|
-
_context15.next =
|
|
1334
|
+
_context15.next = 31;
|
|
1409
1335
|
break;
|
|
1410
|
-
case
|
|
1411
|
-
_context15.prev =
|
|
1336
|
+
case 26:
|
|
1337
|
+
_context15.prev = 26;
|
|
1412
1338
|
_context15.t0 = _context15["catch"](1);
|
|
1413
1339
|
console.error('[PaymentModule] 删除支付项失败', _context15.t0);
|
|
1414
1340
|
this.logError('deletePaymentAsync failed', _context15.t0, {
|
|
@@ -1416,11 +1342,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1416
1342
|
paymentUuid: paymentUuid
|
|
1417
1343
|
});
|
|
1418
1344
|
throw _context15.t0;
|
|
1419
|
-
case
|
|
1345
|
+
case 31:
|
|
1420
1346
|
case "end":
|
|
1421
1347
|
return _context15.stop();
|
|
1422
1348
|
}
|
|
1423
|
-
}, _callee15, this, [[1,
|
|
1349
|
+
}, _callee15, this, [[1, 26]]);
|
|
1424
1350
|
}));
|
|
1425
1351
|
function deletePaymentAsync(_x17, _x18) {
|
|
1426
1352
|
return _deletePaymentAsync.apply(this, arguments);
|
|
@@ -1484,80 +1410,61 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1484
1410
|
existingVoucherItems = order.payment.filter(function (payment) {
|
|
1485
1411
|
return payment.voucher_id && payment.status !== 'voided' && !payment.isSynced;
|
|
1486
1412
|
});
|
|
1487
|
-
console.log('[PaymentModule] 发现现有代金券支付项:', {
|
|
1488
|
-
orderUuid: orderUuid,
|
|
1489
|
-
existingVoucherCount: existingVoucherItems.length,
|
|
1490
|
-
existingItems: existingVoucherItems.map(function (item) {
|
|
1491
|
-
return {
|
|
1492
|
-
uuid: item.uuid,
|
|
1493
|
-
code: item.code,
|
|
1494
|
-
amount: item.amount,
|
|
1495
|
-
voucher_id: item.voucher_id,
|
|
1496
|
-
isSynced: item.isSynced
|
|
1497
|
-
};
|
|
1498
|
-
})
|
|
1499
|
-
});
|
|
1500
|
-
|
|
1501
1413
|
// 2. 删除所有现有的代金券支付项(仅删除未同步的)
|
|
1502
1414
|
_iterator6 = _createForOfIteratorHelper(existingVoucherItems);
|
|
1503
|
-
_context16.prev =
|
|
1415
|
+
_context16.prev = 11;
|
|
1504
1416
|
_iterator6.s();
|
|
1505
|
-
case
|
|
1417
|
+
case 13:
|
|
1506
1418
|
if ((_step6 = _iterator6.n()).done) {
|
|
1507
|
-
_context16.next =
|
|
1419
|
+
_context16.next = 19;
|
|
1508
1420
|
break;
|
|
1509
1421
|
}
|
|
1510
1422
|
voucherItem = _step6.value;
|
|
1511
|
-
|
|
1512
|
-
_context16.next = 19;
|
|
1423
|
+
_context16.next = 17;
|
|
1513
1424
|
return _this5.deletePaymentAsync(orderUuid, voucherItem.uuid);
|
|
1425
|
+
case 17:
|
|
1426
|
+
_context16.next = 13;
|
|
1427
|
+
break;
|
|
1514
1428
|
case 19:
|
|
1515
|
-
_context16.next =
|
|
1429
|
+
_context16.next = 24;
|
|
1516
1430
|
break;
|
|
1517
1431
|
case 21:
|
|
1518
|
-
_context16.
|
|
1519
|
-
|
|
1520
|
-
case 23:
|
|
1521
|
-
_context16.prev = 23;
|
|
1522
|
-
_context16.t0 = _context16["catch"](12);
|
|
1432
|
+
_context16.prev = 21;
|
|
1433
|
+
_context16.t0 = _context16["catch"](11);
|
|
1523
1434
|
_iterator6.e(_context16.t0);
|
|
1524
|
-
case
|
|
1525
|
-
_context16.prev =
|
|
1435
|
+
case 24:
|
|
1436
|
+
_context16.prev = 24;
|
|
1526
1437
|
_iterator6.f();
|
|
1527
|
-
return _context16.finish(
|
|
1528
|
-
case
|
|
1529
|
-
_context16.next =
|
|
1438
|
+
return _context16.finish(24);
|
|
1439
|
+
case 27:
|
|
1440
|
+
_context16.next = 29;
|
|
1530
1441
|
return _this5.getPaymentOrderByUuidAsync(orderUuid);
|
|
1531
|
-
case
|
|
1442
|
+
case 29:
|
|
1532
1443
|
orderAfterDelete = _context16.sent;
|
|
1533
1444
|
if (orderAfterDelete) {
|
|
1534
|
-
_context16.next =
|
|
1445
|
+
_context16.next = 32;
|
|
1535
1446
|
break;
|
|
1536
1447
|
}
|
|
1537
1448
|
throw new Error("\u8BA2\u5355\u4E0D\u5B58\u5728: ".concat(orderUuid));
|
|
1538
|
-
case
|
|
1449
|
+
case 32:
|
|
1539
1450
|
existingActiveVoucherKeys = new Set(orderAfterDelete.payment.filter(function (p) {
|
|
1540
1451
|
return p.voucher_id && p.status !== 'voided' && !p.isSynced;
|
|
1541
1452
|
}).map(function (p) {
|
|
1542
1453
|
return "".concat(p.voucher_id, "|").concat(p.order_payment_type || 'normal');
|
|
1543
1454
|
}));
|
|
1544
|
-
console.log('[PaymentModule] 添加新的代金券支付项:', {
|
|
1545
|
-
orderUuid: orderUuid,
|
|
1546
|
-
newItemCount: normalizedVoucherItems.length
|
|
1547
|
-
});
|
|
1548
1455
|
_iterator7 = _createForOfIteratorHelper(normalizedVoucherItems);
|
|
1549
|
-
_context16.prev =
|
|
1456
|
+
_context16.prev = 34;
|
|
1550
1457
|
_iterator7.s();
|
|
1551
|
-
case
|
|
1458
|
+
case 36:
|
|
1552
1459
|
if ((_step7 = _iterator7.n()).done) {
|
|
1553
|
-
_context16.next =
|
|
1460
|
+
_context16.next = 48;
|
|
1554
1461
|
break;
|
|
1555
1462
|
}
|
|
1556
1463
|
_voucherItem = _step7.value;
|
|
1557
1464
|
orderPaymentType = _voucherItem.order_payment_type || 'normal';
|
|
1558
1465
|
key = "".concat(_voucherItem.voucher_id, "|").concat(orderPaymentType);
|
|
1559
1466
|
if (!existingActiveVoucherKeys.has(key)) {
|
|
1560
|
-
_context16.next =
|
|
1467
|
+
_context16.next = 43;
|
|
1561
1468
|
break;
|
|
1562
1469
|
}
|
|
1563
1470
|
console.warn('[PaymentModule] Skip adding voucher payment item because it already exists (active)', {
|
|
@@ -1565,54 +1472,48 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1565
1472
|
voucher_id: _voucherItem.voucher_id,
|
|
1566
1473
|
order_payment_type: orderPaymentType
|
|
1567
1474
|
});
|
|
1568
|
-
return _context16.abrupt("continue",
|
|
1569
|
-
case
|
|
1570
|
-
|
|
1571
|
-
code: _voucherItem.code,
|
|
1572
|
-
amount: _voucherItem.amount,
|
|
1573
|
-
voucher_id: _voucherItem.voucher_id,
|
|
1574
|
-
order_payment_type: orderPaymentType
|
|
1575
|
-
});
|
|
1576
|
-
_context16.next = 49;
|
|
1475
|
+
return _context16.abrupt("continue", 46);
|
|
1476
|
+
case 43:
|
|
1477
|
+
_context16.next = 45;
|
|
1577
1478
|
return _this5.addPaymentItemAsync(orderUuid, _voucherItem);
|
|
1578
|
-
case
|
|
1479
|
+
case 45:
|
|
1579
1480
|
existingActiveVoucherKeys.add(key);
|
|
1580
|
-
case
|
|
1581
|
-
_context16.next =
|
|
1481
|
+
case 46:
|
|
1482
|
+
_context16.next = 36;
|
|
1582
1483
|
break;
|
|
1583
|
-
case
|
|
1584
|
-
_context16.next =
|
|
1484
|
+
case 48:
|
|
1485
|
+
_context16.next = 53;
|
|
1585
1486
|
break;
|
|
1586
|
-
case
|
|
1587
|
-
_context16.prev =
|
|
1588
|
-
_context16.t1 = _context16["catch"](
|
|
1487
|
+
case 50:
|
|
1488
|
+
_context16.prev = 50;
|
|
1489
|
+
_context16.t1 = _context16["catch"](34);
|
|
1589
1490
|
_iterator7.e(_context16.t1);
|
|
1590
|
-
case
|
|
1591
|
-
_context16.prev =
|
|
1491
|
+
case 53:
|
|
1492
|
+
_context16.prev = 53;
|
|
1592
1493
|
_iterator7.f();
|
|
1593
|
-
return _context16.finish(
|
|
1594
|
-
case
|
|
1595
|
-
_context16.next =
|
|
1494
|
+
return _context16.finish(53);
|
|
1495
|
+
case 56:
|
|
1496
|
+
_context16.next = 58;
|
|
1596
1497
|
return _this5.getPaymentOrderByUuidAsync(orderUuid);
|
|
1597
|
-
case
|
|
1498
|
+
case 58:
|
|
1598
1499
|
updatedOrder = _context16.sent;
|
|
1599
|
-
_context16.next =
|
|
1500
|
+
_context16.next = 61;
|
|
1600
1501
|
return _this5.core.effects.emit("".concat(_this5.name, ":onPaymentAdded"), {
|
|
1601
1502
|
orderUuid: orderUuid,
|
|
1602
1503
|
order: updatedOrder,
|
|
1603
1504
|
payment: null // 批量操作不提供单个支付项
|
|
1604
1505
|
});
|
|
1605
|
-
case
|
|
1506
|
+
case 61:
|
|
1606
1507
|
_this5.logInfo('updateVoucherPaymentItemsAsync completed successfully', {
|
|
1607
1508
|
orderUuid: orderUuid,
|
|
1608
1509
|
removedVoucherCount: existingVoucherItems.length,
|
|
1609
1510
|
addedVoucherCount: normalizedVoucherItems.length,
|
|
1610
1511
|
finalExpectAmount: updatedOrder === null || updatedOrder === void 0 ? void 0 : updatedOrder.expect_amount
|
|
1611
1512
|
});
|
|
1612
|
-
_context16.next =
|
|
1513
|
+
_context16.next = 69;
|
|
1613
1514
|
break;
|
|
1614
|
-
case
|
|
1615
|
-
_context16.prev =
|
|
1515
|
+
case 64:
|
|
1516
|
+
_context16.prev = 64;
|
|
1616
1517
|
_context16.t2 = _context16["catch"](3);
|
|
1617
1518
|
console.error('[PaymentModule] 批量更新代金券支付项失败:', _context16.t2);
|
|
1618
1519
|
_this5.logError('updateVoucherPaymentItemsAsync failed', _context16.t2, {
|
|
@@ -1620,11 +1521,11 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1620
1521
|
voucherPaymentItems: voucherPaymentItems
|
|
1621
1522
|
});
|
|
1622
1523
|
throw _context16.t2;
|
|
1623
|
-
case
|
|
1524
|
+
case 69:
|
|
1624
1525
|
case "end":
|
|
1625
1526
|
return _context16.stop();
|
|
1626
1527
|
}
|
|
1627
|
-
}, _callee16, null, [[3,
|
|
1528
|
+
}, _callee16, null, [[3, 64], [11, 21, 24, 27], [34, 50, 53, 56]]);
|
|
1628
1529
|
}))));
|
|
1629
1530
|
case 1:
|
|
1630
1531
|
case "end":
|
|
@@ -1841,11 +1742,9 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1841
1742
|
if (totalPaidAmount.gte(orderTotalAmount)) {
|
|
1842
1743
|
// 支付金额足够,标记为已完成
|
|
1843
1744
|
order.payment_status = PaymentStatus.Finished;
|
|
1844
|
-
console.log("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u5B8C\u6210\uFF0C\u91D1\u989D: ").concat(totalPaidAmount.toString(), "/").concat(orderTotalAmount.toString()));
|
|
1845
1745
|
} else {
|
|
1846
1746
|
// 支付金额不足,标记为部分支付
|
|
1847
1747
|
order.payment_status = PaymentStatus.PartiallyPaid;
|
|
1848
|
-
console.log("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u90E8\u5206\u652F\u4ED8\uFF0C\u91D1\u989D: ").concat(totalPaidAmount.toString(), "/").concat(orderTotalAmount.toString()));
|
|
1849
1748
|
}
|
|
1850
1749
|
|
|
1851
1750
|
// 给后端标记一下是全部支付(paid)还是部分支付
|
|
@@ -1856,37 +1755,36 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1856
1755
|
return this.dbManager.update('order', order);
|
|
1857
1756
|
case 8:
|
|
1858
1757
|
if (!(paymentData.payments.length === 0)) {
|
|
1859
|
-
_context20.next =
|
|
1758
|
+
_context20.next = 11;
|
|
1860
1759
|
break;
|
|
1861
1760
|
}
|
|
1862
|
-
console.log("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u5217\u8868\u4E3A\u7A7A\uFF0C\u8DF3\u8FC7\u652F\u4ED8\u5904\u7406"));
|
|
1863
1761
|
this.logWarning('Empty payment list', {
|
|
1864
1762
|
orderUuid: order.uuid,
|
|
1865
1763
|
orderId: order.order_id
|
|
1866
1764
|
});
|
|
1867
1765
|
return _context20.abrupt("return");
|
|
1868
|
-
case
|
|
1869
|
-
_context20.next =
|
|
1766
|
+
case 11:
|
|
1767
|
+
_context20.next = 13;
|
|
1870
1768
|
return this.core.effects.emit("".concat(this.name, ":onPaymentSubmitted"), order);
|
|
1871
|
-
case
|
|
1872
|
-
_context20.next =
|
|
1769
|
+
case 13:
|
|
1770
|
+
_context20.next = 15;
|
|
1873
1771
|
return this.core.effects.emit("".concat(this.name, ":onOrderChanged"), {
|
|
1874
1772
|
action: 'submit',
|
|
1875
1773
|
order: order
|
|
1876
1774
|
});
|
|
1877
|
-
case
|
|
1878
|
-
_context20.next =
|
|
1775
|
+
case 15:
|
|
1776
|
+
_context20.next = 21;
|
|
1879
1777
|
break;
|
|
1880
|
-
case
|
|
1881
|
-
_context20.prev =
|
|
1778
|
+
case 17:
|
|
1779
|
+
_context20.prev = 17;
|
|
1882
1780
|
_context20.t0 = _context20["catch"](0);
|
|
1883
1781
|
console.error("[PaymentModule] \u8BA2\u5355 ".concat(order.uuid, " \u652F\u4ED8\u63D0\u4EA4\u5931\u8D25"), _context20.t0);
|
|
1884
1782
|
throw _context20.t0;
|
|
1885
|
-
case
|
|
1783
|
+
case 21:
|
|
1886
1784
|
case "end":
|
|
1887
1785
|
return _context20.stop();
|
|
1888
1786
|
}
|
|
1889
|
-
}, _callee20, this, [[0,
|
|
1787
|
+
}, _callee20, this, [[0, 17]]);
|
|
1890
1788
|
}));
|
|
1891
1789
|
function submitSingleOrderPayment(_x25) {
|
|
1892
1790
|
return _submitSingleOrderPayment.apply(this, arguments);
|
|
@@ -2028,29 +1926,6 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2028
1926
|
// 如果是定金模式,则使用deposit_amount 去减已付款金额
|
|
2029
1927
|
var remainingAmount = order.is_deposit === 1 ? new Decimal(order.deposit_amount).minus(paidAmount) : totalAmount.minus(paidAmount);
|
|
2030
1928
|
order.expect_amount = Decimal.max(0, remainingAmount).toFixed(2);
|
|
2031
|
-
console.log("[PaymentModule] \u91CD\u65B0\u8BA1\u7B97\u8BA2\u5355\u91D1\u989D:", {
|
|
2032
|
-
orderUuid: order.uuid,
|
|
2033
|
-
totalAmount: order.total_amount,
|
|
2034
|
-
effectivePaidAmount: paidAmount.toFixed(2),
|
|
2035
|
-
remainingAmount: order.expect_amount,
|
|
2036
|
-
activePayments: order.payment.filter(function (p) {
|
|
2037
|
-
return p.status !== 'voided';
|
|
2038
|
-
}).length,
|
|
2039
|
-
voidedPayments: order.payment.filter(function (p) {
|
|
2040
|
-
return p.status === 'voided';
|
|
2041
|
-
}).length,
|
|
2042
|
-
paymentDetails: order.payment.filter(function (p) {
|
|
2043
|
-
return p.status !== 'voided';
|
|
2044
|
-
}).map(function (p) {
|
|
2045
|
-
return {
|
|
2046
|
-
code: p.code,
|
|
2047
|
-
amount: p.amount,
|
|
2048
|
-
rounding_amount: p.rounding_amount || '0.00',
|
|
2049
|
-
effective_amount: new Decimal(p.amount || 0).minus(new Decimal(p.rounding_amount || 0)).toFixed(2)
|
|
2050
|
-
};
|
|
2051
|
-
}),
|
|
2052
|
-
说明: '有效支付金额包含抹零计算(amount + |rounding_amount|)'
|
|
2053
|
-
});
|
|
2054
1929
|
}
|
|
2055
1930
|
|
|
2056
1931
|
/**
|
|
@@ -2279,62 +2154,59 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2279
2154
|
|
|
2280
2155
|
// 计算基础值:x / interval
|
|
2281
2156
|
baseValue = amount.div(roundingInterval);
|
|
2282
|
-
console.log("[PaymentModule] \u820D\u5165\u8BA1\u7B97 - \u539F\u59CB\u91D1\u989D: ".concat(amount.toString(), ", \u95F4\u9694: ").concat(intervalValue, ", \u57FA\u7840\u503C: ").concat(baseValue.toString(), ", \u89C4\u5219: ").concat(rule));
|
|
2283
2157
|
_context28.t0 = rule;
|
|
2284
|
-
_context28.next = _context28.t0 === RoundingRule.Standard ?
|
|
2158
|
+
_context28.next = _context28.t0 === RoundingRule.Standard ? 12 : _context28.t0 === 'standard' ? 12 : _context28.t0 === RoundingRule.StandardDown ? 14 : _context28.t0 === 'standard_down' ? 14 : _context28.t0 === RoundingRule.AlwaysUp ? 16 : _context28.t0 === 'always_up' ? 16 : _context28.t0 === RoundingRule.AlwaysDown ? 18 : _context28.t0 === 'always_down' ? 18 : 20;
|
|
2285
2159
|
break;
|
|
2286
|
-
case
|
|
2160
|
+
case 12:
|
|
2287
2161
|
// 标准舍入(中点向上)
|
|
2288
2162
|
roundedValue = this.standardRound(baseValue, true);
|
|
2289
|
-
return _context28.abrupt("break",
|
|
2290
|
-
case
|
|
2163
|
+
return _context28.abrupt("break", 21);
|
|
2164
|
+
case 14:
|
|
2291
2165
|
// 标准舍入(中点向下)
|
|
2292
2166
|
roundedValue = this.standardRound(baseValue, false);
|
|
2293
|
-
return _context28.abrupt("break",
|
|
2294
|
-
case
|
|
2167
|
+
return _context28.abrupt("break", 21);
|
|
2168
|
+
case 16:
|
|
2295
2169
|
// 总是向上舍入
|
|
2296
2170
|
roundedValue = baseValue.ceil();
|
|
2297
|
-
return _context28.abrupt("break",
|
|
2298
|
-
case
|
|
2171
|
+
return _context28.abrupt("break", 21);
|
|
2172
|
+
case 18:
|
|
2299
2173
|
// 总是向下舍入
|
|
2300
2174
|
roundedValue = baseValue.floor();
|
|
2301
|
-
return _context28.abrupt("break",
|
|
2302
|
-
case
|
|
2175
|
+
return _context28.abrupt("break", 21);
|
|
2176
|
+
case 20:
|
|
2303
2177
|
throw new Error("\u4E0D\u652F\u6301\u7684\u820D\u5165\u89C4\u5219: ".concat(rule));
|
|
2304
|
-
case
|
|
2178
|
+
case 21:
|
|
2305
2179
|
// 计算最终金额:roundedValue * interval
|
|
2306
2180
|
finalAmount = roundedValue.mul(roundingInterval);
|
|
2307
2181
|
originalAmountStr = amount.toFixed(2); // 如果最终金额是 0 元,则不采用舍入金额,返回原始金额
|
|
2308
2182
|
if (!finalAmount.eq(0)) {
|
|
2309
|
-
_context28.next =
|
|
2183
|
+
_context28.next = 25;
|
|
2310
2184
|
break;
|
|
2311
2185
|
}
|
|
2312
|
-
console.log("[PaymentModule] \u6700\u7EC8\u91D1\u989D\u4E3A0\uFF0C\u8FD4\u56DE\u539F\u59CB\u91D1\u989D: ".concat(originalAmountStr));
|
|
2313
2186
|
return _context28.abrupt("return", {
|
|
2314
2187
|
originalAmount: originalAmountStr,
|
|
2315
2188
|
roundedAmount: originalAmountStr,
|
|
2316
2189
|
roundingDifference: '0.00'
|
|
2317
2190
|
});
|
|
2318
|
-
case
|
|
2191
|
+
case 25:
|
|
2319
2192
|
roundedAmountStr = finalAmount.toFixed(2); // 计算舍入差额
|
|
2320
2193
|
roundingDifference = finalAmount.sub(amount);
|
|
2321
2194
|
roundingDifferenceStr = roundingDifference.toFixed(2);
|
|
2322
|
-
console.log("[PaymentModule] \u820D\u5165\u7ED3\u679C - \u539F\u59CB\u91D1\u989D: ".concat(originalAmountStr, ", \u820D\u5165\u540E\u91D1\u989D: ").concat(roundedAmountStr, ", \u820D\u5165\u5DEE\u989D: ").concat(roundingDifferenceStr));
|
|
2323
2195
|
return _context28.abrupt("return", {
|
|
2324
2196
|
originalAmount: originalAmountStr,
|
|
2325
2197
|
roundedAmount: roundedAmountStr,
|
|
2326
2198
|
roundingDifference: roundingDifferenceStr
|
|
2327
2199
|
});
|
|
2328
|
-
case
|
|
2329
|
-
_context28.prev =
|
|
2200
|
+
case 31:
|
|
2201
|
+
_context28.prev = 31;
|
|
2330
2202
|
_context28.t1 = _context28["catch"](0);
|
|
2331
2203
|
console.error('[PaymentModule] 金额舍入失败:', _context28.t1);
|
|
2332
2204
|
throw new Error("\u91D1\u989D\u820D\u5165\u5931\u8D25: ".concat(_context28.t1 instanceof Error ? _context28.t1.message : String(_context28.t1)));
|
|
2333
|
-
case
|
|
2205
|
+
case 35:
|
|
2334
2206
|
case "end":
|
|
2335
2207
|
return _context28.stop();
|
|
2336
2208
|
}
|
|
2337
|
-
}, _callee28, this, [[0,
|
|
2209
|
+
}, _callee28, this, [[0, 31]]);
|
|
2338
2210
|
}));
|
|
2339
2211
|
function roundAmountAsync(_x29, _x30, _x31) {
|
|
2340
2212
|
return _roundAmountAsync.apply(this, arguments);
|