@pisell/pisellos 0.0.311 → 0.0.312
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.
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
};
|
|
327
327
|
setOtherData(key: string, value: any): void;
|
|
328
328
|
getOtherData(key: string): any;
|
|
329
|
-
getProductTypeById(id: number): Promise<"
|
|
329
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
330
330
|
/**
|
|
331
331
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
332
332
|
*
|
|
@@ -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
|
}
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
};
|
|
327
327
|
setOtherData(key: string, value: any): void;
|
|
328
328
|
getOtherData(key: string): any;
|
|
329
|
-
getProductTypeById(id: number): Promise<"
|
|
329
|
+
getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
|
|
330
330
|
/**
|
|
331
331
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
332
332
|
*
|
|
@@ -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
|
}
|