@pisell/pisellos 0.0.298 → 0.0.300
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.
|
@@ -496,6 +496,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
496
496
|
item.deposit = deposit;
|
|
497
497
|
if (deposit !== null && deposit !== void 0 && deposit.total && Number(deposit.total) > 0) {
|
|
498
498
|
summaryDeposit.protocols = summaryDeposit.protocols.concat(deposit.protocols);
|
|
499
|
+
summaryDeposit.total = new Decimal(summaryDeposit.total).plus(deposit.total).toNumber();
|
|
499
500
|
summaryDeposit.hasDeposit = true;
|
|
500
501
|
}
|
|
501
502
|
});
|
|
@@ -1668,15 +1669,17 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1668
1669
|
updateParams = {
|
|
1669
1670
|
is_deposit: newDepositValue
|
|
1670
1671
|
}; // 如果从定金改为全款,可以清空定金金额
|
|
1671
|
-
if (
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1672
|
+
// if (
|
|
1673
|
+
// isDeposit === 0 &&
|
|
1674
|
+
// this.store.currentOrder.deposit_amount !== '0.00'
|
|
1675
|
+
// ) {
|
|
1676
|
+
// updateParams.deposit_amount = '0.00';
|
|
1677
|
+
// this.logInfo('订单从定金改为全款,清空定金金额');
|
|
1678
|
+
// }
|
|
1676
1679
|
// 调用 Payment 模块更新订单
|
|
1677
|
-
_context19.next =
|
|
1680
|
+
_context19.next = 13;
|
|
1678
1681
|
return this.payment.updateOrderAsync(this.store.currentOrder.uuid, updateParams);
|
|
1679
|
-
case
|
|
1682
|
+
case 13:
|
|
1680
1683
|
// 更新本地缓存的订单对象
|
|
1681
1684
|
this.store.currentOrder = _objectSpread(_objectSpread({}, this.store.currentOrder), updateParams);
|
|
1682
1685
|
|
|
@@ -1687,31 +1690,31 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1687
1690
|
this.updateStateAmountToRemaining();
|
|
1688
1691
|
|
|
1689
1692
|
// 触发订单更新事件
|
|
1690
|
-
_context19.next =
|
|
1693
|
+
_context19.next = 18;
|
|
1691
1694
|
return this.core.effects.emit(CheckoutHooks.OnOrderCreated, {
|
|
1692
1695
|
order: this.store.currentOrder,
|
|
1693
1696
|
timestamp: Date.now()
|
|
1694
1697
|
});
|
|
1695
|
-
case
|
|
1698
|
+
case 18:
|
|
1696
1699
|
this.logInfo('订单定金状态更新成功:', {
|
|
1697
1700
|
isDeposit: newDepositValue,
|
|
1698
1701
|
depositAmount: this.store.currentOrder.deposit_amount
|
|
1699
1702
|
});
|
|
1700
|
-
_context19.next =
|
|
1703
|
+
_context19.next = 27;
|
|
1701
1704
|
break;
|
|
1702
|
-
case
|
|
1703
|
-
_context19.prev =
|
|
1705
|
+
case 21:
|
|
1706
|
+
_context19.prev = 21;
|
|
1704
1707
|
_context19.t0 = _context19["catch"](0);
|
|
1705
1708
|
this.logError('更新订单定金状态失败:', _context19.t0);
|
|
1706
|
-
_context19.next =
|
|
1709
|
+
_context19.next = 26;
|
|
1707
1710
|
return this.handleError(_context19.t0, CheckoutErrorType.ValidationFailed);
|
|
1708
|
-
case
|
|
1711
|
+
case 26:
|
|
1709
1712
|
throw _context19.t0;
|
|
1710
|
-
case
|
|
1713
|
+
case 27:
|
|
1711
1714
|
case "end":
|
|
1712
1715
|
return _context19.stop();
|
|
1713
1716
|
}
|
|
1714
|
-
}, _callee19, this, [[0,
|
|
1717
|
+
}, _callee19, this, [[0, 21]]);
|
|
1715
1718
|
}));
|
|
1716
1719
|
function updateOrderDepositStatusAsync(_x18) {
|
|
1717
1720
|
return _updateOrderDepositStatusAsync.apply(this, arguments);
|
|
@@ -488,6 +488,7 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
488
488
|
discount.tag = discount.type;
|
|
489
489
|
}
|
|
490
490
|
editModeDiscountList.push(_objectSpread(_objectSpread({}, discount), {}, {
|
|
491
|
+
name: discount.name || discount.discount.title.auto,
|
|
491
492
|
isEditMode: true,
|
|
492
493
|
limited_relation_product_data: {},
|
|
493
494
|
savedAmount: discount.amount * ((product === null || product === void 0 ? void 0 : product.num) || 1),
|
|
@@ -295,6 +295,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
295
295
|
summaryDeposit.protocols = summaryDeposit.protocols.concat(
|
|
296
296
|
deposit.protocols
|
|
297
297
|
);
|
|
298
|
+
summaryDeposit.total = new import_decimal.default(summaryDeposit.total).plus(deposit.total).toNumber();
|
|
298
299
|
summaryDeposit.hasDeposit = true;
|
|
299
300
|
}
|
|
300
301
|
});
|
|
@@ -1080,10 +1081,6 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1080
1081
|
const updateParams = {
|
|
1081
1082
|
is_deposit: newDepositValue
|
|
1082
1083
|
};
|
|
1083
|
-
if (isDeposit === 0 && this.store.currentOrder.deposit_amount !== "0.00") {
|
|
1084
|
-
updateParams.deposit_amount = "0.00";
|
|
1085
|
-
this.logInfo("订单从定金改为全款,清空定金金额");
|
|
1086
|
-
}
|
|
1087
1084
|
await this.payment.updateOrderAsync(
|
|
1088
1085
|
this.store.currentOrder.uuid,
|
|
1089
1086
|
updateParams
|
|
@@ -1783,7 +1780,9 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1783
1780
|
return "0.00";
|
|
1784
1781
|
}
|
|
1785
1782
|
let totalAmount = new import_decimal.default(this.store.currentOrder.total_amount || "0");
|
|
1786
|
-
const currentOrder = await this.payment.getPaymentOrderByUuidAsync(
|
|
1783
|
+
const currentOrder = await this.payment.getPaymentOrderByUuidAsync(
|
|
1784
|
+
this.store.currentOrder.uuid
|
|
1785
|
+
);
|
|
1787
1786
|
if ((currentOrder == null ? void 0 : currentOrder.is_deposit) && (currentOrder == null ? void 0 : currentOrder.deposit_amount) && Number(currentOrder == null ? void 0 : currentOrder.deposit_amount) > 0) {
|
|
1788
1787
|
totalAmount = new import_decimal.default(currentOrder == null ? void 0 : currentOrder.deposit_amount);
|
|
1789
1788
|
}
|
|
@@ -1829,8 +1828,12 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1829
1828
|
var _a, _b, _c, _d;
|
|
1830
1829
|
try {
|
|
1831
1830
|
if (((_a = this.store.currentOrder) == null ? void 0 : _a.is_deposit) === 1) {
|
|
1832
|
-
const paymentItems = await this.payment.getPaymentItemsAsync(
|
|
1833
|
-
|
|
1831
|
+
const paymentItems = await this.payment.getPaymentItemsAsync(
|
|
1832
|
+
(_b = this.store.currentOrder) == null ? void 0 : _b.uuid
|
|
1833
|
+
);
|
|
1834
|
+
const depositPaidAmount = paymentItems.filter(
|
|
1835
|
+
(item) => item.order_payment_type === "deposit" && item.status !== "voided"
|
|
1836
|
+
).reduce((sum, item) => {
|
|
1834
1837
|
if (item.voucher_id && !item.isSynced) {
|
|
1835
1838
|
return sum;
|
|
1836
1839
|
}
|
|
@@ -2048,13 +2051,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2048
2051
|
deposit: void 0
|
|
2049
2052
|
};
|
|
2050
2053
|
}),
|
|
2051
|
-
relation_products: (_f = this.store.localOrderData.relation_products) == null ? void 0 : _f.map(
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2054
|
+
relation_products: (_f = this.store.localOrderData.relation_products) == null ? void 0 : _f.map(
|
|
2055
|
+
(item) => {
|
|
2056
|
+
return {
|
|
2057
|
+
...item,
|
|
2058
|
+
custom_deposit_data: void 0,
|
|
2059
|
+
deposit: void 0
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
)
|
|
2058
2063
|
};
|
|
2059
2064
|
if (isUpdateOperation) {
|
|
2060
2065
|
if ((0, import_utils.isVirtualOrderId)(currentOrderId)) {
|
|
@@ -324,6 +324,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
324
324
|
}
|
|
325
325
|
editModeDiscountList.push({
|
|
326
326
|
...discount,
|
|
327
|
+
name: discount.name || discount.discount.title.auto,
|
|
327
328
|
isEditMode: true,
|
|
328
329
|
limited_relation_product_data: {},
|
|
329
330
|
savedAmount: discount.amount * ((product == null ? void 0 : product.num) || 1),
|