@pisell/pisellos 2.1.27 → 2.1.28
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.
|
@@ -677,7 +677,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
677
677
|
value: (function () {
|
|
678
678
|
var _updateLocalOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
679
679
|
var _params$orderData6, _params$orderData7, _params$cartSummary2, _params$totalInfo5, _params$totalInfo6, _params$totalInfo7, _params$totalInfo8;
|
|
680
|
-
var validation, amountInfo, customerInfo, allOrders, existingOrder, _updated$payment, totalAmount, activePayments, paidAmount, remaining, _isNeedDeposit, updated, syncedAmount, remainingExpectAmount, isNeedDeposit, created;
|
|
680
|
+
var validation, amountInfo, customerInfo, allOrders, existingOrder, _updated$payment, totalAmount, activePayments, paidAmount, remaining, _isNeedDeposit, updated, syncedAmount, remainingExpectAmount, depositDiffAmount, isNeedDeposit, created;
|
|
681
681
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
682
682
|
while (1) switch (_context10.prev = _context10.next) {
|
|
683
683
|
case 0:
|
|
@@ -730,7 +730,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
730
730
|
return String(o.id) === String(params.orderId) || String(o.order_id) === String(params.orderId);
|
|
731
731
|
});
|
|
732
732
|
if (!existingOrder) {
|
|
733
|
-
_context10.next =
|
|
733
|
+
_context10.next = 44;
|
|
734
734
|
break;
|
|
735
735
|
}
|
|
736
736
|
// 基于现有支付项计算新的 expect_amount
|
|
@@ -798,15 +798,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
798
798
|
var rounding = new Decimal(p.rounding_amount || '0').abs();
|
|
799
799
|
return sum.plus(amt).plus(rounding);
|
|
800
800
|
}, new Decimal(0));
|
|
801
|
-
remainingExpectAmount = Decimal.max(0, totalAmount.minus(syncedAmount)).toFixed(2);
|
|
801
|
+
remainingExpectAmount = Decimal.max(0, totalAmount.minus(syncedAmount)).toFixed(2); // 要计算一个总价的差值和一个定金的差值,如果定金的差值>0,则需要使用定金的差值,否则使用总价的差值
|
|
802
|
+
depositDiffAmount = new Decimal(0).toFixed(2);
|
|
803
|
+
if (updated.is_deposit === 1) {
|
|
804
|
+
depositDiffAmount = new Decimal(updated.deposit_amount).minus(syncedAmount).toFixed(2);
|
|
805
|
+
}
|
|
802
806
|
this.initWalletData({
|
|
803
|
-
order_wait_pay_amount: Number(remainingExpectAmount)
|
|
807
|
+
order_wait_pay_amount: Number(depositDiffAmount) > 0 ? Number(depositDiffAmount) : Number(remainingExpectAmount)
|
|
804
808
|
});
|
|
805
809
|
return _context10.abrupt("return", updated);
|
|
806
|
-
case
|
|
810
|
+
case 44:
|
|
807
811
|
// 计算是否需要支付定金,如果需要默认切换到定金模式,以及记录定金总金额,并把当前默认待付金额调整为定金总金额
|
|
808
812
|
isNeedDeposit = this.checkIsNeedDepositAsync(params.orderData.bookings, params.orderData.relation_products); // 没找到现有订单时,回退为创建逻辑(用于异常兜底)
|
|
809
|
-
_context10.next =
|
|
813
|
+
_context10.next = 47;
|
|
810
814
|
return this.payment.createPaymentOrderAsync({
|
|
811
815
|
order_id: String(params.orderId),
|
|
812
816
|
total_amount: amountInfo.totalAmount,
|
|
@@ -823,12 +827,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
823
827
|
amount_breakdown: amountInfo
|
|
824
828
|
}
|
|
825
829
|
});
|
|
826
|
-
case
|
|
830
|
+
case 47:
|
|
827
831
|
created = _context10.sent;
|
|
828
832
|
this.store.currentOrder = created;
|
|
829
833
|
this.initWalletData();
|
|
830
834
|
return _context10.abrupt("return", created);
|
|
831
|
-
case
|
|
835
|
+
case 51:
|
|
832
836
|
case "end":
|
|
833
837
|
return _context10.stop();
|
|
834
838
|
}
|
|
@@ -1675,7 +1679,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1675
1679
|
console.log('[Checkout] 定金状态无变化,跳过更新');
|
|
1676
1680
|
return _context19.abrupt("return");
|
|
1677
1681
|
case 10:
|
|
1678
|
-
deposit_amount =
|
|
1682
|
+
deposit_amount = this.store.currentOrder.deposit_amount || '0.00'; // 如果原来没有 deposit_amount,则默认把待付金额置为 deposit_amount
|
|
1679
1683
|
if (!deposit_amount || Number(deposit_amount) === 0) {
|
|
1680
1684
|
deposit_amount = this.store.currentOrder.expect_amount;
|
|
1681
1685
|
}
|
|
@@ -3268,6 +3272,35 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3268
3272
|
reason: '手动设置和计算值均为0'
|
|
3269
3273
|
});
|
|
3270
3274
|
}
|
|
3275
|
+
// 如果此时是普通支付状态,并且要同步的支付项里一个定金支付的都没有,则 is_deposit 和 deposit_amount 都置为 0
|
|
3276
|
+
if (this.store.currentOrder.is_deposit === 0 && processedPaymentItems.every(function (item) {
|
|
3277
|
+
return item.order_payment_type !== 'deposit';
|
|
3278
|
+
})) {
|
|
3279
|
+
finalDepositAmount = '0.00';
|
|
3280
|
+
this.store.currentOrder.is_deposit = 0;
|
|
3281
|
+
}
|
|
3282
|
+
// 如果此时是普通支付,并且有普通支付项进来了,则提交给后端的 deposit_amount 只能是支付项里已经支付的order_payment_type = deposit 的金额
|
|
3283
|
+
if (this.store.currentOrder.is_deposit === 0 && processedPaymentItems.some(function (item) {
|
|
3284
|
+
return item.order_payment_type === 'deposit';
|
|
3285
|
+
})) {
|
|
3286
|
+
finalDepositAmount = processedPaymentItems.filter(function (item) {
|
|
3287
|
+
return item.status !== 'voided' && item.order_payment_type === 'deposit';
|
|
3288
|
+
}).reduce(function (sum, item) {
|
|
3289
|
+
var amt = new Decimal(item.amount || '0');
|
|
3290
|
+
var rounding = new Decimal(item.rounding_amount || '0');
|
|
3291
|
+
return sum.plus(amt).sub(rounding);
|
|
3292
|
+
}, new Decimal(0)).toFixed(2);
|
|
3293
|
+
}
|
|
3294
|
+
// 如果当前是定金支付,并且定金额度已经大于等于了订单总计,则 finalDepositAmount 为实际付出去的定金金额
|
|
3295
|
+
if (this.store.currentOrder.is_deposit === 1 && new Decimal(finalDepositAmount).gte(new Decimal(this.store.currentOrder.total_amount))) {
|
|
3296
|
+
finalDepositAmount = processedPaymentItems.filter(function (item) {
|
|
3297
|
+
return item.status !== 'voided' && item.order_payment_type === 'deposit';
|
|
3298
|
+
}).reduce(function (sum, item) {
|
|
3299
|
+
var amt = new Decimal(item.amount || '0');
|
|
3300
|
+
var rounding = new Decimal(item.rounding_amount || '0');
|
|
3301
|
+
return sum.plus(amt).sub(rounding);
|
|
3302
|
+
}, new Decimal(0)).toFixed(2);
|
|
3303
|
+
}
|
|
3271
3304
|
this.logInfo('定金金额确定结果', {
|
|
3272
3305
|
depositPaymentItemsCount: processedPaymentItems.length,
|
|
3273
3306
|
depositPaymentItems: processedPaymentItems.map(function (item) {
|
|
@@ -3335,7 +3368,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3335
3368
|
|
|
3336
3369
|
// 发送下单接口请求开始事件
|
|
3337
3370
|
startTime = Date.now();
|
|
3338
|
-
_context36.next =
|
|
3371
|
+
_context36.next = 27;
|
|
3339
3372
|
return this.core.effects.emit(CheckoutHooks.OnOrderSubmitStart, {
|
|
3340
3373
|
orderUuid: this.store.currentOrder.uuid,
|
|
3341
3374
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
@@ -3343,9 +3376,9 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3343
3376
|
paymentItemCount: paymentItems.length,
|
|
3344
3377
|
timestamp: startTime
|
|
3345
3378
|
});
|
|
3346
|
-
case
|
|
3379
|
+
case 27:
|
|
3347
3380
|
submitSuccess = false;
|
|
3348
|
-
_context36.prev =
|
|
3381
|
+
_context36.prev = 28;
|
|
3349
3382
|
// 记录接口调用参数
|
|
3350
3383
|
this.logInfo('Calling backend checkout API', _objectSpread({
|
|
3351
3384
|
url: '/order/checkout',
|
|
@@ -3353,23 +3386,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3353
3386
|
}, orderParams));
|
|
3354
3387
|
|
|
3355
3388
|
// 调用 Order 模块的专用 createOrderByCheckout 方法
|
|
3356
|
-
_context36.next =
|
|
3389
|
+
_context36.next = 32;
|
|
3357
3390
|
return this.order.createOrderByCheckout(orderParams);
|
|
3358
|
-
case
|
|
3391
|
+
case 32:
|
|
3359
3392
|
checkoutResponse = _context36.sent;
|
|
3360
3393
|
submitSuccess = true;
|
|
3361
3394
|
this.logInfo('下单接口调用成功', checkoutResponse);
|
|
3362
|
-
_context36.next =
|
|
3395
|
+
_context36.next = 45;
|
|
3363
3396
|
break;
|
|
3364
|
-
case
|
|
3365
|
-
_context36.prev =
|
|
3366
|
-
_context36.t1 = _context36["catch"](
|
|
3397
|
+
case 37:
|
|
3398
|
+
_context36.prev = 37;
|
|
3399
|
+
_context36.t1 = _context36["catch"](28);
|
|
3367
3400
|
submitSuccess = false;
|
|
3368
3401
|
submitError = _context36.t1 instanceof Error ? _context36.t1.message : String(_context36.t1);
|
|
3369
3402
|
this.logError('下单接口调用失败:', submitError);
|
|
3370
3403
|
|
|
3371
3404
|
// 发送订单同步失败事件(网络错误或请求失败)
|
|
3372
|
-
_context36.next =
|
|
3405
|
+
_context36.next = 44;
|
|
3373
3406
|
return this.core.effects.emit(CheckoutHooks.OnOrderSyncFailed, {
|
|
3374
3407
|
orderUuid: this.store.currentOrder.uuid,
|
|
3375
3408
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
@@ -3379,11 +3412,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3379
3412
|
duration: Date.now() - startTime,
|
|
3380
3413
|
timestamp: Date.now()
|
|
3381
3414
|
});
|
|
3382
|
-
case
|
|
3415
|
+
case 44:
|
|
3383
3416
|
throw _context36.t1;
|
|
3384
|
-
case
|
|
3385
|
-
_context36.prev =
|
|
3386
|
-
_context36.next =
|
|
3417
|
+
case 45:
|
|
3418
|
+
_context36.prev = 45;
|
|
3419
|
+
_context36.next = 48;
|
|
3387
3420
|
return this.core.effects.emit(CheckoutHooks.OnOrderSubmitEnd, {
|
|
3388
3421
|
success: submitSuccess,
|
|
3389
3422
|
orderUuid: this.store.currentOrder.uuid,
|
|
@@ -3394,18 +3427,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3394
3427
|
duration: Date.now() - startTime,
|
|
3395
3428
|
timestamp: Date.now()
|
|
3396
3429
|
});
|
|
3397
|
-
case
|
|
3398
|
-
return _context36.finish(
|
|
3399
|
-
case
|
|
3430
|
+
case 48:
|
|
3431
|
+
return _context36.finish(45);
|
|
3432
|
+
case 49:
|
|
3400
3433
|
// 检查响应状态是否为成功状态
|
|
3401
3434
|
responseStatus = (_checkoutResponse3 = checkoutResponse) === null || _checkoutResponse3 === void 0 ? void 0 : _checkoutResponse3.status;
|
|
3402
3435
|
isSuccessResponse = responseStatus === true || responseStatus === 200 || responseStatus === 'success' || responseStatus === 1 && ((_checkoutResponse4 = checkoutResponse) === null || _checkoutResponse4 === void 0 ? void 0 : _checkoutResponse4.code) === 200;
|
|
3403
3436
|
if (isSuccessResponse) {
|
|
3404
|
-
_context36.next =
|
|
3437
|
+
_context36.next = 56;
|
|
3405
3438
|
break;
|
|
3406
3439
|
}
|
|
3407
3440
|
errorMessage = ((_checkoutResponse5 = checkoutResponse) === null || _checkoutResponse5 === void 0 ? void 0 : _checkoutResponse5.message) || '订单同步失败,后端返回非成功状态'; // 发送订单同步失败事件
|
|
3408
|
-
_context36.next =
|
|
3441
|
+
_context36.next = 55;
|
|
3409
3442
|
return this.core.effects.emit(CheckoutHooks.OnOrderSyncFailed, {
|
|
3410
3443
|
orderUuid: this.store.currentOrder.uuid,
|
|
3411
3444
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
@@ -3416,18 +3449,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3416
3449
|
duration: Date.now() - startTime,
|
|
3417
3450
|
timestamp: Date.now()
|
|
3418
3451
|
});
|
|
3419
|
-
case
|
|
3452
|
+
case 55:
|
|
3420
3453
|
throw new Error(errorMessage);
|
|
3421
|
-
case
|
|
3454
|
+
case 56:
|
|
3422
3455
|
if (!isUpdateOperation) {
|
|
3423
|
-
_context36.next =
|
|
3456
|
+
_context36.next = 60;
|
|
3424
3457
|
break;
|
|
3425
3458
|
}
|
|
3426
3459
|
// 更新操作:使用现有的订单ID
|
|
3427
3460
|
realOrderId = currentOrderId;
|
|
3428
|
-
_context36.next =
|
|
3461
|
+
_context36.next = 79;
|
|
3429
3462
|
break;
|
|
3430
|
-
case
|
|
3463
|
+
case 60:
|
|
3431
3464
|
// 创建操作:从响应中提取新的订单ID
|
|
3432
3465
|
extractedOrderId = (_checkoutResponse6 = checkoutResponse) === null || _checkoutResponse6 === void 0 || (_checkoutResponse6 = _checkoutResponse6.data) === null || _checkoutResponse6 === void 0 ? void 0 : _checkoutResponse6.order_id; // 如果data.order_id不存在,尝试直接从根级获取
|
|
3433
3466
|
if (!extractedOrderId) {
|
|
@@ -3449,10 +3482,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3449
3482
|
oldOrderId: this.store.currentOrder.order_id,
|
|
3450
3483
|
newOrderId: realOrderId
|
|
3451
3484
|
});
|
|
3452
|
-
_context36.prev =
|
|
3453
|
-
_context36.next =
|
|
3485
|
+
_context36.prev = 66;
|
|
3486
|
+
_context36.next = 69;
|
|
3454
3487
|
return this.payment.replaceOrderIdByUuidAsync(this.store.currentOrder.uuid, realOrderId);
|
|
3455
|
-
case
|
|
3488
|
+
case 69:
|
|
3456
3489
|
updatedOrder = _context36.sent;
|
|
3457
3490
|
this.logInfo('Payment模块替换订单ID结果:', {
|
|
3458
3491
|
wasSuccessful: !!updatedOrder,
|
|
@@ -3479,66 +3512,66 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3479
3512
|
目标ID: realOrderId
|
|
3480
3513
|
});
|
|
3481
3514
|
}
|
|
3482
|
-
_context36.next =
|
|
3515
|
+
_context36.next = 79;
|
|
3483
3516
|
break;
|
|
3484
|
-
case
|
|
3485
|
-
_context36.prev =
|
|
3486
|
-
_context36.t2 = _context36["catch"](
|
|
3517
|
+
case 74:
|
|
3518
|
+
_context36.prev = 74;
|
|
3519
|
+
_context36.t2 = _context36["catch"](66);
|
|
3487
3520
|
this.logError('调用Payment模块替换订单ID时发生错误:', _context36.t2);
|
|
3488
3521
|
|
|
3489
3522
|
// 发生错误时也进行手动替换
|
|
3490
3523
|
this.store.currentOrder.order_id = realOrderId;
|
|
3491
3524
|
this.logInfo('错误恢复:手动设置订单ID:', realOrderId);
|
|
3492
|
-
case
|
|
3493
|
-
_context36.prev =
|
|
3525
|
+
case 79:
|
|
3526
|
+
_context36.prev = 79;
|
|
3494
3527
|
syncedPaymentUuids = processedPaymentItems.filter(function (item) {
|
|
3495
3528
|
return item.status !== 'voided';
|
|
3496
3529
|
}).map(function (item) {
|
|
3497
3530
|
return item.uuid;
|
|
3498
3531
|
}).filter(Boolean);
|
|
3499
3532
|
_iterator3 = _createForOfIteratorHelper(syncedPaymentUuids);
|
|
3500
|
-
_context36.prev =
|
|
3533
|
+
_context36.prev = 82;
|
|
3501
3534
|
_iterator3.s();
|
|
3502
|
-
case
|
|
3535
|
+
case 84:
|
|
3503
3536
|
if ((_step3 = _iterator3.n()).done) {
|
|
3504
|
-
_context36.next =
|
|
3537
|
+
_context36.next = 90;
|
|
3505
3538
|
break;
|
|
3506
3539
|
}
|
|
3507
3540
|
paymentUuid = _step3.value;
|
|
3508
|
-
_context36.next =
|
|
3541
|
+
_context36.next = 88;
|
|
3509
3542
|
return this.payment.updatePaymentAsync(this.store.currentOrder.uuid, paymentUuid, {
|
|
3510
3543
|
isSynced: true,
|
|
3511
3544
|
syncError: undefined
|
|
3512
3545
|
});
|
|
3513
|
-
case
|
|
3514
|
-
_context36.next =
|
|
3546
|
+
case 88:
|
|
3547
|
+
_context36.next = 84;
|
|
3515
3548
|
break;
|
|
3516
|
-
case
|
|
3517
|
-
_context36.next =
|
|
3549
|
+
case 90:
|
|
3550
|
+
_context36.next = 95;
|
|
3518
3551
|
break;
|
|
3519
|
-
case 89:
|
|
3520
|
-
_context36.prev = 89;
|
|
3521
|
-
_context36.t3 = _context36["catch"](79);
|
|
3522
|
-
_iterator3.e(_context36.t3);
|
|
3523
3552
|
case 92:
|
|
3524
3553
|
_context36.prev = 92;
|
|
3525
|
-
|
|
3526
|
-
|
|
3554
|
+
_context36.t3 = _context36["catch"](82);
|
|
3555
|
+
_iterator3.e(_context36.t3);
|
|
3527
3556
|
case 95:
|
|
3528
|
-
_context36.
|
|
3557
|
+
_context36.prev = 95;
|
|
3558
|
+
_iterator3.f();
|
|
3559
|
+
return _context36.finish(95);
|
|
3560
|
+
case 98:
|
|
3561
|
+
_context36.next = 103;
|
|
3529
3562
|
break;
|
|
3530
|
-
case
|
|
3531
|
-
_context36.prev =
|
|
3532
|
-
_context36.t4 = _context36["catch"](
|
|
3563
|
+
case 100:
|
|
3564
|
+
_context36.prev = 100;
|
|
3565
|
+
_context36.t4 = _context36["catch"](79);
|
|
3533
3566
|
this.logWarning('标记支付项已同步失败(不阻塞主流程)', {
|
|
3534
3567
|
error: _context36.t4
|
|
3535
3568
|
});
|
|
3536
|
-
case
|
|
3569
|
+
case 103:
|
|
3537
3570
|
// 标记订单已同步
|
|
3538
3571
|
this.store.isOrderSynced = true;
|
|
3539
3572
|
|
|
3540
3573
|
// 触发订单同步完成事件
|
|
3541
|
-
_context36.next =
|
|
3574
|
+
_context36.next = 106;
|
|
3542
3575
|
return this.core.effects.emit(CheckoutHooks.OnOrderSynced, {
|
|
3543
3576
|
orderUuid: this.store.currentOrder.uuid,
|
|
3544
3577
|
realOrderId: realOrderId,
|
|
@@ -3547,18 +3580,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3547
3580
|
isManual: isManual,
|
|
3548
3581
|
response: checkoutResponse
|
|
3549
3582
|
});
|
|
3550
|
-
case
|
|
3583
|
+
case 106:
|
|
3551
3584
|
return _context36.abrupt("return", {
|
|
3552
3585
|
success: true,
|
|
3553
3586
|
orderId: realOrderId,
|
|
3554
3587
|
orderUuid: this.store.currentOrder.uuid,
|
|
3555
3588
|
response: checkoutResponse
|
|
3556
3589
|
});
|
|
3557
|
-
case
|
|
3590
|
+
case 107:
|
|
3558
3591
|
case "end":
|
|
3559
3592
|
return _context36.stop();
|
|
3560
3593
|
}
|
|
3561
|
-
}, _callee36, this, [[
|
|
3594
|
+
}, _callee36, this, [[28, 37, 45, 49], [66, 74], [79, 100], [82, 92, 95, 98]]);
|
|
3562
3595
|
}));
|
|
3563
3596
|
function syncOrderToBackendWithReturn() {
|
|
3564
3597
|
return _syncOrderToBackendWithReturn.apply(this, arguments);
|
|
@@ -530,8 +530,12 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
530
530
|
const remainingExpectAmount = import_decimal.default.max(0, totalAmount.minus(syncedAmount)).toFixed(
|
|
531
531
|
2
|
|
532
532
|
);
|
|
533
|
+
let depositDiffAmount = new import_decimal.default(0).toFixed(2);
|
|
534
|
+
if (updated.is_deposit === 1) {
|
|
535
|
+
depositDiffAmount = new import_decimal.default(updated.deposit_amount).minus(syncedAmount).toFixed(2);
|
|
536
|
+
}
|
|
533
537
|
this.initWalletData({
|
|
534
|
-
order_wait_pay_amount: Number(remainingExpectAmount)
|
|
538
|
+
order_wait_pay_amount: Number(depositDiffAmount) > 0 ? Number(depositDiffAmount) : Number(remainingExpectAmount)
|
|
535
539
|
});
|
|
536
540
|
return updated;
|
|
537
541
|
}
|
|
@@ -1094,7 +1098,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1094
1098
|
console.log("[Checkout] 定金状态无变化,跳过更新");
|
|
1095
1099
|
return;
|
|
1096
1100
|
}
|
|
1097
|
-
let deposit_amount =
|
|
1101
|
+
let deposit_amount = this.store.currentOrder.deposit_amount || "0.00";
|
|
1098
1102
|
if (!deposit_amount || Number(deposit_amount) === 0) {
|
|
1099
1103
|
deposit_amount = this.store.currentOrder.expect_amount;
|
|
1100
1104
|
}
|
|
@@ -2024,6 +2028,24 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2024
2028
|
reason: "手动设置和计算值均为0"
|
|
2025
2029
|
});
|
|
2026
2030
|
}
|
|
2031
|
+
if (this.store.currentOrder.is_deposit === 0 && processedPaymentItems.every((item) => item.order_payment_type !== "deposit")) {
|
|
2032
|
+
finalDepositAmount = "0.00";
|
|
2033
|
+
this.store.currentOrder.is_deposit = 0;
|
|
2034
|
+
}
|
|
2035
|
+
if (this.store.currentOrder.is_deposit === 0 && processedPaymentItems.some((item) => item.order_payment_type === "deposit")) {
|
|
2036
|
+
finalDepositAmount = processedPaymentItems.filter((item) => item.status !== "voided" && item.order_payment_type === "deposit").reduce((sum, item) => {
|
|
2037
|
+
const amt = new import_decimal.default(item.amount || "0");
|
|
2038
|
+
const rounding = new import_decimal.default(item.rounding_amount || "0");
|
|
2039
|
+
return sum.plus(amt).sub(rounding);
|
|
2040
|
+
}, new import_decimal.default(0)).toFixed(2);
|
|
2041
|
+
}
|
|
2042
|
+
if (this.store.currentOrder.is_deposit === 1 && new import_decimal.default(finalDepositAmount).gte(new import_decimal.default(this.store.currentOrder.total_amount))) {
|
|
2043
|
+
finalDepositAmount = processedPaymentItems.filter((item) => item.status !== "voided" && item.order_payment_type === "deposit").reduce((sum, item) => {
|
|
2044
|
+
const amt = new import_decimal.default(item.amount || "0");
|
|
2045
|
+
const rounding = new import_decimal.default(item.rounding_amount || "0");
|
|
2046
|
+
return sum.plus(amt).sub(rounding);
|
|
2047
|
+
}, new import_decimal.default(0)).toFixed(2);
|
|
2048
|
+
}
|
|
2027
2049
|
this.logInfo("定金金额确定结果", {
|
|
2028
2050
|
depositPaymentItemsCount: processedPaymentItems.length,
|
|
2029
2051
|
depositPaymentItems: processedPaymentItems.map((item) => ({
|