@pisell/pisellos 0.0.480 → 0.0.481
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.d.ts +3 -2
- package/dist/core/index.js +7 -0
- package/dist/effects/index.d.ts +2 -2
- package/dist/effects/index.js +34 -81
- package/dist/model/strategy/adapter/promotion/evaluator.js +99 -26
- package/dist/model/strategy/adapter/walletPass/type.d.ts +9 -2
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +6 -6
- package/dist/model/strategy/adapter/walletPass/utils.js +104 -77
- package/dist/modules/Customer/index.js +1 -1
- package/dist/modules/Discount/index.d.ts +6 -2
- package/dist/modules/Discount/index.js +14 -8
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/index.js +18 -13
- package/dist/modules/Payment/index.d.ts +4 -0
- package/dist/modules/Payment/index.js +774 -649
- package/dist/modules/Payment/walletpass.js +44 -17
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +2 -0
- package/dist/modules/ProductList/index.d.ts +3 -0
- package/dist/modules/ProductList/index.js +9 -7
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +37 -31
- package/dist/modules/Rules/types.d.ts +2 -2
- package/dist/modules/Schedule/index.d.ts +9 -0
- package/dist/modules/Schedule/index.js +15 -2
- package/dist/plugins/app-types/app/app.d.ts +1 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +107 -2
- package/dist/server/index.js +1507 -279
- package/dist/server/modules/index.d.ts +6 -0
- package/dist/server/modules/index.js +7 -0
- package/dist/server/modules/menu/index.d.ts +19 -0
- package/dist/server/modules/menu/index.js +221 -71
- package/dist/server/modules/order/index.d.ts +87 -0
- package/dist/server/modules/order/index.js +916 -0
- package/dist/server/modules/order/types.d.ts +530 -0
- package/dist/server/modules/order/types.js +141 -0
- package/dist/server/modules/order/utils/filterBookings.d.ts +6 -0
- package/dist/server/modules/order/utils/filterBookings.js +350 -0
- package/dist/server/modules/order/utils/filterOrders.d.ts +15 -0
- package/dist/server/modules/order/utils/filterOrders.js +226 -0
- package/dist/server/modules/products/index.d.ts +117 -5
- package/dist/server/modules/products/index.js +1450 -240
- package/dist/server/modules/products/types.d.ts +25 -1
- package/dist/server/modules/products/types.js +3 -0
- package/dist/server/modules/resource/index.d.ts +86 -0
- package/dist/server/modules/resource/index.js +1128 -0
- package/dist/server/modules/resource/types.d.ts +121 -0
- package/dist/server/modules/resource/types.js +47 -0
- package/dist/server/modules/schedule/index.d.ts +19 -0
- package/dist/server/modules/schedule/index.js +229 -68
- package/dist/server/utils/product.d.ts +5 -0
- package/dist/server/utils/product.js +71 -31
- package/dist/solution/BookingTicket/index.d.ts +10 -2
- package/dist/solution/BookingTicket/index.js +41 -28
- package/dist/solution/BookingTicket/utils/scan/index.js +1 -1
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +286 -188
- package/dist/solution/Checkout/utils/index.d.ts +2 -1
- package/dist/solution/Checkout/utils/index.js +6 -4
- package/dist/solution/RegisterAndLogin/config.js +340 -1
- package/dist/solution/Sales/index.d.ts +96 -0
- package/dist/solution/Sales/index.js +566 -0
- package/dist/solution/Sales/types.d.ts +67 -0
- package/dist/solution/Sales/types.js +26 -0
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +35 -22
- package/dist/solution/ShopDiscount/types.d.ts +6 -0
- package/dist/solution/ShopDiscount/utils.d.ts +9 -0
- package/dist/solution/ShopDiscount/utils.js +21 -27
- package/dist/solution/index.d.ts +2 -1
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +5 -0
- package/lib/core/index.d.ts +3 -2
- package/lib/core/index.js +4 -0
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +22 -31
- package/lib/model/strategy/adapter/promotion/evaluator.js +57 -8
- package/lib/model/strategy/adapter/walletPass/type.d.ts +9 -2
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +6 -6
- package/lib/model/strategy/adapter/walletPass/utils.js +113 -49
- package/lib/modules/Customer/index.js +1 -1
- package/lib/modules/Discount/index.d.ts +6 -2
- package/lib/modules/Discount/index.js +3 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/index.js +20 -18
- package/lib/modules/Payment/index.d.ts +4 -0
- package/lib/modules/Payment/index.js +134 -66
- package/lib/modules/Payment/walletpass.js +23 -4
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +2 -0
- package/lib/modules/ProductList/index.d.ts +3 -0
- package/lib/modules/ProductList/index.js +2 -2
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +69 -73
- package/lib/modules/Rules/types.d.ts +2 -2
- package/lib/modules/Schedule/index.d.ts +9 -0
- package/lib/modules/Schedule/index.js +11 -0
- package/lib/plugins/app-types/app/app.d.ts +1 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +107 -2
- package/lib/server/index.js +773 -51
- package/lib/server/modules/index.d.ts +6 -0
- package/lib/server/modules/index.js +16 -2
- package/lib/server/modules/menu/index.d.ts +19 -0
- package/lib/server/modules/menu/index.js +121 -2
- package/lib/server/modules/order/index.d.ts +87 -0
- package/lib/server/modules/order/index.js +543 -0
- package/lib/server/modules/order/types.d.ts +530 -0
- package/lib/server/modules/order/types.js +34 -0
- package/lib/server/modules/order/utils/filterBookings.d.ts +6 -0
- package/lib/server/modules/order/utils/filterBookings.js +320 -0
- package/lib/server/modules/order/utils/filterOrders.d.ts +15 -0
- package/lib/server/modules/order/utils/filterOrders.js +197 -0
- package/lib/server/modules/products/index.d.ts +117 -5
- package/lib/server/modules/products/index.js +799 -62
- package/lib/server/modules/products/types.d.ts +25 -1
- package/lib/server/modules/products/types.js +1 -0
- package/lib/server/modules/resource/index.d.ts +86 -0
- package/lib/server/modules/resource/index.js +557 -0
- package/lib/server/modules/resource/types.d.ts +121 -0
- package/lib/server/modules/resource/types.js +35 -0
- package/lib/server/modules/schedule/index.d.ts +19 -0
- package/lib/server/modules/schedule/index.js +141 -12
- package/lib/server/utils/product.d.ts +5 -0
- package/lib/server/utils/product.js +56 -27
- package/lib/solution/BookingTicket/index.d.ts +10 -2
- package/lib/solution/BookingTicket/index.js +10 -2
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -1
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +399 -331
- package/lib/solution/Checkout/utils/index.d.ts +2 -1
- package/lib/solution/Checkout/utils/index.js +6 -4
- package/lib/solution/RegisterAndLogin/config.js +266 -1
- package/lib/solution/Sales/index.d.ts +96 -0
- package/lib/solution/Sales/index.js +416 -0
- package/lib/solution/Sales/types.d.ts +67 -0
- package/lib/solution/Sales/types.js +35 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -6
- package/lib/solution/ShopDiscount/types.d.ts +6 -0
- package/lib/solution/ShopDiscount/utils.d.ts +9 -0
- package/lib/solution/ShopDiscount/utils.js +6 -10
- package/lib/solution/index.d.ts +2 -1
- package/lib/solution/index.js +4 -2
- package/lib/types/index.d.ts +5 -0
- package/package.json +1 -1
|
@@ -12,6 +12,63 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
12
12
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
14
|
import Decimal from 'decimal.js';
|
|
15
|
+
/** 订单商品数量 */
|
|
16
|
+
export var getProductQuantity = function getProductQuantity(product) {
|
|
17
|
+
return product.quantity || product.product_quantity || 1;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 订单商品行唯一键,用于 maxPassesPerItem 按行、按件配额(同 SPU 不同规格视为不同行)。
|
|
22
|
+
*/
|
|
23
|
+
export function resolveWalletPassLineKey(product, indexInOrder) {
|
|
24
|
+
var m = (product === null || product === void 0 ? void 0 : product.metadata) || {};
|
|
25
|
+
var u1 = m.product_unique;
|
|
26
|
+
if (u1 != null && String(u1).length > 0) return String(u1);
|
|
27
|
+
var u2 = m.unique_identification_number;
|
|
28
|
+
if (u2 != null && String(u2).length > 0) return String(u2);
|
|
29
|
+
if ((product === null || product === void 0 ? void 0 : product.id) != null && String(product.id).length > 0) return "order_item:".concat(product.id);
|
|
30
|
+
if ((product === null || product === void 0 ? void 0 : product.product_unique_string) != null && String(product.product_unique_string).length > 0) {
|
|
31
|
+
return String(product.product_unique_string);
|
|
32
|
+
}
|
|
33
|
+
return "order_line_".concat(indexInOrder);
|
|
34
|
+
}
|
|
35
|
+
function getExpandedOrderLineQuantity(p) {
|
|
36
|
+
if ((p === null || p === void 0 ? void 0 : p._orderLineQuantity) != null && p._orderLineQuantity > 0) return p._orderLineQuantity;
|
|
37
|
+
return getProductQuantity(p);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** 该行允许消耗的「券次」上限:maxPassesPerItem × 订单行件数 */
|
|
41
|
+
function getMaxPassSlotsForExpandedLine(maxPassesPerItem, p) {
|
|
42
|
+
if (maxPassesPerItem <= 0) return Infinity;
|
|
43
|
+
return maxPassesPerItem * getExpandedOrderLineQuantity(p);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 本次抵扣占用多少「券次」配额:有抵扣时至少占 1,并与按金额折算的件数挂钩,不超过剩余额度。
|
|
48
|
+
*/
|
|
49
|
+
function computePassSlotsIncrement(deductAmount, deductQty, maxPassesPerItem, orderLineQuantity, currentUsage) {
|
|
50
|
+
if (maxPassesPerItem <= 0 || !deductAmount.greaterThan(0)) return 0;
|
|
51
|
+
var cap = maxPassesPerItem * orderLineQuantity;
|
|
52
|
+
var room = Math.max(0, cap - currentUsage);
|
|
53
|
+
if (room <= 0) return 0;
|
|
54
|
+
var raw = Math.max(1, Math.ceil(Number(deductQty)) || 1);
|
|
55
|
+
return Math.min(raw, room);
|
|
56
|
+
}
|
|
57
|
+
function applyMaxPassUsageIncrements(usageMap, walletPassProductId, maxPassesPerItem, deductionDetails) {
|
|
58
|
+
deductionDetails.forEach(function (detail) {
|
|
59
|
+
var _usageMap$get;
|
|
60
|
+
var lineKey = detail.lineKey;
|
|
61
|
+
if (!lineKey || maxPassesPerItem <= 0) return;
|
|
62
|
+
var orderLineQty = detail.orderLineQuantity != null && detail.orderLineQuantity > 0 ? detail.orderLineQuantity : 1;
|
|
63
|
+
var cur = ((_usageMap$get = usageMap.get(walletPassProductId)) === null || _usageMap$get === void 0 ? void 0 : _usageMap$get.get(lineKey)) || 0;
|
|
64
|
+
var inc = computePassSlotsIncrement(new Decimal(detail.deductAmount), detail.deductQuantity, maxPassesPerItem, orderLineQty, cur);
|
|
65
|
+
if (inc <= 0) return;
|
|
66
|
+
if (!usageMap.has(walletPassProductId)) usageMap.set(walletPassProductId, new Map());
|
|
67
|
+
var inner = usageMap.get(walletPassProductId);
|
|
68
|
+
inner.set(lineKey, cur + inc);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
15
72
|
// 辅助函数:根据 deductTaxAndFee 配置获取推荐使用金额
|
|
16
73
|
var getRecommendedAmount = function getRecommendedAmount(voucher) {
|
|
17
74
|
var _config$deductTaxAndF;
|
|
@@ -101,18 +158,6 @@ var getApplicableProducts = function getApplicableProducts(voucher, productsData
|
|
|
101
158
|
});
|
|
102
159
|
};
|
|
103
160
|
|
|
104
|
-
/**
|
|
105
|
-
* 计算指定 product_id 在展开后的商品列表中的总 quantity
|
|
106
|
-
* 处理同一 product_id 可能分散在多条记录中的情况(如3个独立的 quantity=1 条目)
|
|
107
|
-
*/
|
|
108
|
-
var getTotalQuantityByProductId = function getTotalQuantityByProductId(allProducts, productId) {
|
|
109
|
-
return allProducts.filter(function (p) {
|
|
110
|
-
return p.product_id === productId;
|
|
111
|
-
}).reduce(function (sum, p) {
|
|
112
|
-
return sum + getProductQuantity(p);
|
|
113
|
-
}, 0);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
161
|
/**
|
|
117
162
|
* 优惠券处理函数
|
|
118
163
|
* @param applicableVouchers 可用的券列表
|
|
@@ -130,29 +175,19 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
130
175
|
var productsCopy = expandProductsWithBundleItems(products, true);
|
|
131
176
|
var remainingOrderAmount = new Decimal(orderTotalAmount); // 订单剩余应付金额
|
|
132
177
|
|
|
133
|
-
// ========== 辅助工具:maxPassesPerItem
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return ((_usageMap$get = usageMap.get(walletPassProductId)) === null || _usageMap$get === void 0 ? void 0 : _usageMap$get.get(orderItemProductId)) || 0;
|
|
178
|
+
// ========== 辅助工具:maxPassesPerItem(按订单行 + 件数)追踪 ==========
|
|
179
|
+
var getItemPassUsage = function getItemPassUsage(usageMap, walletPassProductId, lineKey) {
|
|
180
|
+
var _usageMap$get2;
|
|
181
|
+
return ((_usageMap$get2 = usageMap.get(walletPassProductId)) === null || _usageMap$get2 === void 0 ? void 0 : _usageMap$get2.get(lineKey)) || 0;
|
|
138
182
|
};
|
|
139
183
|
|
|
140
|
-
//
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
if (!usageMap.has(walletPassProductId)) {
|
|
144
|
-
usageMap.set(walletPassProductId, new Map());
|
|
145
|
-
}
|
|
146
|
-
var innerMap = usageMap.get(walletPassProductId);
|
|
147
|
-
innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + count);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// 按 maxPassesPerItem 过滤商品:排除已达到单商品可用卡券上限的商品
|
|
151
|
-
// maxPassesPerItem 是 per-unit 的限制,总上限 = maxPassesPerItem × 该 product_id 的总 quantity
|
|
152
|
-
var filterByMaxPassesPerItem = function filterByMaxPassesPerItem(products, allProducts, usageMap, walletPassProductId, maxPassesPerItem) {
|
|
153
|
-
if (maxPassesPerItem <= 0) return products; // 0 = 不限制
|
|
184
|
+
// 按 maxPassesPerItem 过滤:排除已达到该行「券次」上限的展开行(按 _walletPassLineKey)
|
|
185
|
+
var filterByMaxPassesPerItem = function filterByMaxPassesPerItem(products, usageMap, walletPassProductId, maxPassesPerItem) {
|
|
186
|
+
if (maxPassesPerItem <= 0) return products;
|
|
154
187
|
return products.filter(function (p) {
|
|
155
|
-
|
|
188
|
+
var lineKey = p._walletPassLineKey;
|
|
189
|
+
if (!lineKey) return true;
|
|
190
|
+
return getItemPassUsage(usageMap, walletPassProductId, lineKey) < getMaxPassSlotsForExpandedLine(maxPassesPerItem, p);
|
|
156
191
|
});
|
|
157
192
|
};
|
|
158
193
|
// ================================================================
|
|
@@ -189,7 +224,7 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
189
224
|
|
|
190
225
|
// 按 maxPassesPerItem 过滤:排除已达到单商品可用卡券上限的商品
|
|
191
226
|
if (itemPassUsage) {
|
|
192
|
-
applicableProducts = filterByMaxPassesPerItem(applicableProducts,
|
|
227
|
+
applicableProducts = filterByMaxPassesPerItem(applicableProducts, itemPassUsage, voucher.product_id, maxPassesPerItem);
|
|
193
228
|
}
|
|
194
229
|
if (applicableProducts.length === 0) {
|
|
195
230
|
return new Decimal(0);
|
|
@@ -301,7 +336,9 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
301
336
|
var availableAfterPassLimit = getApplicableProducts(voucher, productsData).filter(function (p) {
|
|
302
337
|
return p[amountField].greaterThan(0);
|
|
303
338
|
}).filter(function (p) {
|
|
304
|
-
|
|
339
|
+
var lineKey = p._walletPassLineKey;
|
|
340
|
+
if (!lineKey) return true;
|
|
341
|
+
return getItemPassUsage(itemPassUsage, product_id, lineKey) < getMaxPassSlotsForExpandedLine(maxPassesPerItem, p);
|
|
305
342
|
});
|
|
306
343
|
if (availableAfterPassLimit.length === 0) {
|
|
307
344
|
return {
|
|
@@ -337,7 +374,7 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
337
374
|
// 重置商品余额追踪(同时维护含税和不含税两个金额池)
|
|
338
375
|
var productsForRecommendation = expandProductsWithBundleItems(products, true);
|
|
339
376
|
remainingOrderAmount = new Decimal(orderTotalAmount);
|
|
340
|
-
// 追踪推荐阶段每个 Wallet Pass
|
|
377
|
+
// 追踪推荐阶段每个 Wallet Pass 商品对每个订单商品行的已使用卡券次数(按行唯一键)
|
|
341
378
|
var itemPassUsageMap = new Map();
|
|
342
379
|
|
|
343
380
|
/**
|
|
@@ -398,7 +435,7 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
398
435
|
});
|
|
399
436
|
|
|
400
437
|
// 按 maxPassesPerItem 过滤:排除已达到单商品可用卡券上限的商品
|
|
401
|
-
applicableProducts = filterByMaxPassesPerItem(applicableProducts,
|
|
438
|
+
applicableProducts = filterByMaxPassesPerItem(applicableProducts, itemPassUsageMap, product_id, maxPassesPerItem);
|
|
402
439
|
if (applicableProducts.length === 0) return false;
|
|
403
440
|
|
|
404
441
|
// ========== 关键修改:在应用券之前,基于当前剩余金额计算 _available_max_amount ==========
|
|
@@ -492,6 +529,8 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
492
529
|
product_id: _product.product_id,
|
|
493
530
|
parent_product_id: _product.parent_product_id || null,
|
|
494
531
|
is_bundle_item: _product.is_bundle_item || false,
|
|
532
|
+
lineKey: _product._walletPassLineKey,
|
|
533
|
+
orderLineQuantity: getExpandedOrderLineQuantity(_product),
|
|
495
534
|
deductAmount: actualDeductAmount.toNumber(),
|
|
496
535
|
// 转换为数字
|
|
497
536
|
deductQuantity: actualDeductQty // 抵扣涉及的数量(用于记录)
|
|
@@ -525,6 +564,8 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
525
564
|
product_id: targetProduct.product_id,
|
|
526
565
|
parent_product_id: targetProduct.parent_product_id || null,
|
|
527
566
|
is_bundle_item: targetProduct.is_bundle_item || false,
|
|
567
|
+
lineKey: targetProduct._walletPassLineKey,
|
|
568
|
+
orderLineQuantity: getExpandedOrderLineQuantity(targetProduct),
|
|
528
569
|
deductAmount: _actualDeductAmount.toNumber(),
|
|
529
570
|
deductQuantity: _actualDeductQty
|
|
530
571
|
});
|
|
@@ -536,11 +577,7 @@ export function processVouchers(applicableVouchers, orderTotalAmount, products)
|
|
|
536
577
|
|
|
537
578
|
// 更新券使用次数(按 product_id 统计)
|
|
538
579
|
usedVoucherCounts.set(product_id, (usedVoucherCounts.get(product_id) || 0) + 1);
|
|
539
|
-
|
|
540
|
-
// 更新 maxPassesPerItem 追踪:按实际抵扣数量递增
|
|
541
|
-
deductionDetails.forEach(function (detail) {
|
|
542
|
-
incrementItemPassUsage(itemPassUsageMap, product_id, detail.product_id, detail.deductQuantity);
|
|
543
|
-
});
|
|
580
|
+
applyMaxPassUsageIncrements(itemPassUsageMap, product_id, maxPassesPerItem, deductionDetails);
|
|
544
581
|
|
|
545
582
|
// 添加到推荐列表(包含基于当前剩余金额计算的 available_max_amount)
|
|
546
583
|
recommendedVouchers.push(_objectSpread(_objectSpread({}, voucher), {}, {
|
|
@@ -623,25 +660,18 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
623
660
|
var remainingOrderAmount = new Decimal(orderTotalAmount);
|
|
624
661
|
var selectedWithDetails = [];
|
|
625
662
|
|
|
626
|
-
// 追踪每个 Wallet Pass
|
|
627
|
-
// Map<walletPassProductId, Map<orderItemProductId, usedCount>>
|
|
663
|
+
// 追踪每个 Wallet Pass 商品对每个订单商品行的已使用卡券次数(按行唯一键)
|
|
628
664
|
var itemPassUsageMap = new Map();
|
|
629
|
-
var
|
|
665
|
+
var getItemPassUsageRecalc = function getItemPassUsageRecalc(walletPassProductId, lineKey) {
|
|
630
666
|
var _itemPassUsageMap$get;
|
|
631
|
-
return ((_itemPassUsageMap$get = itemPassUsageMap.get(walletPassProductId)) === null || _itemPassUsageMap$get === void 0 ? void 0 : _itemPassUsageMap$get.get(
|
|
632
|
-
};
|
|
633
|
-
var incrementItemPassUsage = function incrementItemPassUsage(walletPassProductId, orderItemProductId) {
|
|
634
|
-
var count = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
635
|
-
if (!itemPassUsageMap.has(walletPassProductId)) {
|
|
636
|
-
itemPassUsageMap.set(walletPassProductId, new Map());
|
|
637
|
-
}
|
|
638
|
-
var innerMap = itemPassUsageMap.get(walletPassProductId);
|
|
639
|
-
innerMap.set(orderItemProductId, (innerMap.get(orderItemProductId) || 0) + count);
|
|
667
|
+
return ((_itemPassUsageMap$get = itemPassUsageMap.get(walletPassProductId)) === null || _itemPassUsageMap$get === void 0 ? void 0 : _itemPassUsageMap$get.get(lineKey)) || 0;
|
|
640
668
|
};
|
|
641
|
-
var
|
|
642
|
-
if (maxPassesPerItem <= 0) return products;
|
|
669
|
+
var filterByMaxPassesPerItemRecalc = function filterByMaxPassesPerItemRecalc(products, walletPassProductId, maxPassesPerItem) {
|
|
670
|
+
if (maxPassesPerItem <= 0) return products;
|
|
643
671
|
return products.filter(function (p) {
|
|
644
|
-
|
|
672
|
+
var lineKey = p._walletPassLineKey;
|
|
673
|
+
if (!lineKey) return true;
|
|
674
|
+
return getItemPassUsageRecalc(walletPassProductId, lineKey) < getMaxPassSlotsForExpandedLine(maxPassesPerItem, p);
|
|
645
675
|
});
|
|
646
676
|
};
|
|
647
677
|
|
|
@@ -666,8 +696,8 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
666
696
|
return p[amountField].greaterThan(0);
|
|
667
697
|
});
|
|
668
698
|
|
|
669
|
-
// 按 maxPassesPerItem
|
|
670
|
-
applicableProducts =
|
|
699
|
+
// 按 maxPassesPerItem 过滤:排除已达到该行券次上限的展开行
|
|
700
|
+
applicableProducts = filterByMaxPassesPerItemRecalc(applicableProducts, selectedVoucher.product_id, maxPassesPerItem);
|
|
671
701
|
if (applicableProducts.length === 0) {
|
|
672
702
|
// 无适用商品,跳过
|
|
673
703
|
selectedWithDetails.push(_objectSpread(_objectSpread({}, selectedVoucher), {}, {
|
|
@@ -718,6 +748,8 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
718
748
|
product_id: product.product_id,
|
|
719
749
|
parent_product_id: product.parent_product_id || null,
|
|
720
750
|
is_bundle_item: product.is_bundle_item || false,
|
|
751
|
+
lineKey: product._walletPassLineKey,
|
|
752
|
+
orderLineQuantity: getExpandedOrderLineQuantity(product),
|
|
721
753
|
deductAmount: actualDeductAmount.toNumber(),
|
|
722
754
|
// 转换为数字
|
|
723
755
|
deductQuantity: actualDeductQty // 抵扣涉及的数量(用于记录)
|
|
@@ -751,6 +783,8 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
751
783
|
product_id: targetProduct.product_id,
|
|
752
784
|
parent_product_id: targetProduct.parent_product_id || null,
|
|
753
785
|
is_bundle_item: targetProduct.is_bundle_item || false,
|
|
786
|
+
lineKey: targetProduct._walletPassLineKey,
|
|
787
|
+
orderLineQuantity: getExpandedOrderLineQuantity(targetProduct),
|
|
754
788
|
deductAmount: _actualDeductAmount2.toNumber(),
|
|
755
789
|
deductQuantity: _actualDeductQty2
|
|
756
790
|
});
|
|
@@ -759,11 +793,7 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
759
793
|
|
|
760
794
|
// 更新订单剩余金额
|
|
761
795
|
remainingOrderAmount = remainingOrderAmount.minus(totalDeducted);
|
|
762
|
-
|
|
763
|
-
// 更新 maxPassesPerItem 追踪:按实际抵扣数量递增
|
|
764
|
-
deductionDetails.forEach(function (detail) {
|
|
765
|
-
incrementItemPassUsage(selectedVoucher.product_id, detail.product_id, detail.deductQuantity);
|
|
766
|
-
});
|
|
796
|
+
applyMaxPassUsageIncrements(itemPassUsageMap, selectedVoucher.product_id, maxPassesPerItem, deductionDetails);
|
|
767
797
|
selectedWithDetails.push(_objectSpread(_objectSpread({}, selectedVoucher), {}, {
|
|
768
798
|
actualDeduction: totalDeducted.toNumber(),
|
|
769
799
|
// 转换为数字
|
|
@@ -836,7 +866,7 @@ export function recalculateVouchers(allVouchers, selectedVouchers, orderTotalAmo
|
|
|
836
866
|
});
|
|
837
867
|
|
|
838
868
|
// 按 maxPassesPerItem 过滤:排除已达到单商品可用卡券上限的商品
|
|
839
|
-
applicableProducts =
|
|
869
|
+
applicableProducts = filterByMaxPassesPerItemRecalc(applicableProducts, product_id, maxPassesPerItem);
|
|
840
870
|
if (applicableProducts.length === 0) {
|
|
841
871
|
isAvailable = false;
|
|
842
872
|
reasonCode = 'not_meet_the_required_conditions';
|
|
@@ -950,7 +980,7 @@ export var getProductDiscountDifference = function getProductDiscountDifference(
|
|
|
950
980
|
* @returns 商品单价
|
|
951
981
|
*/
|
|
952
982
|
export var getMainProductPrice = function getMainProductPrice(product, isDeductTaxAndFee) {
|
|
953
|
-
var _product$metadata4, _product$metadata5, _product$metadata6;
|
|
983
|
+
var _product$metadata4, _product$metadata5, _product$metadata6, _product$metadata7;
|
|
954
984
|
var mainProductPrice = new Decimal((product === null || product === void 0 ? void 0 : product.main_product_selling_price) || ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.main_product_selling_price) || 0);
|
|
955
985
|
var _iterator6 = _createForOfIteratorHelper((product === null || product === void 0 ? void 0 : product.product_bundle) || []),
|
|
956
986
|
_step6;
|
|
@@ -970,14 +1000,14 @@ export var getMainProductPrice = function getMainProductPrice(product, isDeductT
|
|
|
970
1000
|
} finally {
|
|
971
1001
|
_iterator6.f();
|
|
972
1002
|
}
|
|
973
|
-
var taxFee = new Decimal((product === null || product === void 0 ? void 0 : product.tax_fee) || (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_attached_bundle_tax_fee) || 0);
|
|
1003
|
+
var taxFee = new Decimal((product === null || product === void 0 ? void 0 : product.tax_fee) || (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.main_product_attached_bundle_tax_fee) || 0).add((product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.tax_fee_rounding_remainder) || 0);
|
|
974
1004
|
if (product.is_price_include_tax === 1) {
|
|
975
1005
|
taxFee = new Decimal(0);
|
|
976
1006
|
}
|
|
977
1007
|
|
|
978
1008
|
// 税费
|
|
979
1009
|
// 附加费
|
|
980
|
-
var surchargeFee = new Decimal((product === null || product === void 0 || (_product$
|
|
1010
|
+
var surchargeFee = new Decimal((product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.main_product_attached_bundle_surcharge_fee) || 0);
|
|
981
1011
|
|
|
982
1012
|
// 税费附加费总额
|
|
983
1013
|
var taxAndFeeTotal = taxFee.add(surchargeFee);
|
|
@@ -1059,8 +1089,9 @@ export var getBundleItemPrice = function getBundleItemPrice(bundleItem, parentQu
|
|
|
1059
1089
|
*/
|
|
1060
1090
|
var expandProductsWithBundleItems = function expandProductsWithBundleItems(products, deductTaxAndFee) {
|
|
1061
1091
|
var expandedProducts = [];
|
|
1062
|
-
products.forEach(function (product) {
|
|
1092
|
+
products.forEach(function (product, indexInOrder) {
|
|
1063
1093
|
var productQuantity = getProductQuantity(product);
|
|
1094
|
+
var parentLineKey = resolveWalletPassLineKey(product, indexInOrder);
|
|
1064
1095
|
|
|
1065
1096
|
// 计算主商品单价(含税和不含税)
|
|
1066
1097
|
var unitPriceWithTax = getMainProductPrice(product, true);
|
|
@@ -1075,6 +1106,8 @@ var expandProductsWithBundleItems = function expandProductsWithBundleItems(produ
|
|
|
1075
1106
|
expandedProducts.push(_objectSpread(_objectSpread({}, product), {}, {
|
|
1076
1107
|
is_bundle_item: false,
|
|
1077
1108
|
parent_product_id: null,
|
|
1109
|
+
_walletPassLineKey: parentLineKey,
|
|
1110
|
+
_orderLineQuantity: productQuantity,
|
|
1078
1111
|
// 单价(用于按 quantity 计算抵扣)
|
|
1079
1112
|
unitPriceWithTax: new Decimal(unitPriceWithTax),
|
|
1080
1113
|
unitPricePure: new Decimal(unitPricePure),
|
|
@@ -1091,6 +1124,7 @@ var expandProductsWithBundleItems = function expandProductsWithBundleItems(produ
|
|
|
1091
1124
|
product.product_bundle.forEach(function (bundleItem) {
|
|
1092
1125
|
if (getBundleItemIsOriginalPrice(bundleItem)) {
|
|
1093
1126
|
var bundleQuantity = bundleItem.num * productQuantity;
|
|
1127
|
+
var bundleLineKey = "".concat(parentLineKey, "#bundle:").concat(bundleItem.bundle_id, ":").concat(bundleItem.bundle_product_id);
|
|
1094
1128
|
// 计算子商品单价(注意:getBundleItemPrice 返回的是总价,需要除以数量得到单价)
|
|
1095
1129
|
var bundleUnitPriceWithTax = new Decimal(getBundleItemPrice(bundleItem, 1, true)).dividedBy(bundleItem.num);
|
|
1096
1130
|
var bundleUnitPricePure = new Decimal(getBundleItemPrice(bundleItem, 1, false)).dividedBy(bundleItem.num);
|
|
@@ -1108,6 +1142,8 @@ var expandProductsWithBundleItems = function expandProductsWithBundleItems(produ
|
|
|
1108
1142
|
parent_product_id: product.product_id,
|
|
1109
1143
|
quantity: bundleQuantity,
|
|
1110
1144
|
// 子商品数量 * 主商品数量
|
|
1145
|
+
_walletPassLineKey: bundleLineKey,
|
|
1146
|
+
_orderLineQuantity: bundleQuantity,
|
|
1111
1147
|
// 单价(用于按 quantity 计算抵扣)
|
|
1112
1148
|
unitPriceWithTax: bundleUnitPriceWithTax,
|
|
1113
1149
|
unitPricePure: bundleUnitPricePure,
|
|
@@ -1125,15 +1161,6 @@ var expandProductsWithBundleItems = function expandProductsWithBundleItems(produ
|
|
|
1125
1161
|
return expandedProducts;
|
|
1126
1162
|
};
|
|
1127
1163
|
|
|
1128
|
-
/**
|
|
1129
|
-
* 获取商品数量
|
|
1130
|
-
* @param product 商品
|
|
1131
|
-
* @returns 商品数量
|
|
1132
|
-
*/
|
|
1133
|
-
export var getProductQuantity = function getProductQuantity(product) {
|
|
1134
|
-
return product.quantity || product.product_quantity || 1;
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
1164
|
// bundle商品是否是原价
|
|
1138
1165
|
export var getBundleItemIsOriginalPrice = function getBundleItemIsOriginalPrice(item) {
|
|
1139
1166
|
return (item === null || item === void 0 ? void 0 : item.price_type) === 'markup' && (item === null || item === void 0 ? void 0 : item.price_type_ext) === 'product_price';
|
|
@@ -17,14 +17,18 @@ export declare class DiscountModule extends BaseModule implements Module, Discou
|
|
|
17
17
|
setOriginalDiscountList(originalDiscountList: Discount[]): Promise<void>;
|
|
18
18
|
getOriginalDiscountList(): Discount[];
|
|
19
19
|
loadPrepareConfig(params: {
|
|
20
|
-
action?: 'create';
|
|
20
|
+
action?: 'create' | 'update';
|
|
21
21
|
with_good_pass: 0 | 1;
|
|
22
22
|
with_discount_card: 0 | 1;
|
|
23
23
|
customer_id: number;
|
|
24
24
|
with_wallet_pass_holder: 0 | 1;
|
|
25
25
|
request_timezone: string;
|
|
26
|
+
order_id?: number;
|
|
27
|
+
}): Promise<Discount[]>;
|
|
28
|
+
batchSearch(code: string, options?: {
|
|
29
|
+
customerId?: number;
|
|
30
|
+
orderId?: number;
|
|
26
31
|
}): Promise<Discount[]>;
|
|
27
|
-
batchSearch(code: string, customerId?: number): Promise<Discount[]>;
|
|
28
32
|
batchSearchByProductIds(productIds: number[]): Promise<any>;
|
|
29
33
|
filterEnabledDiscountList(discountList: Discount[]): Discount[];
|
|
30
34
|
private checkUsageCreditsLimit;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -176,13 +178,14 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
176
178
|
}, {
|
|
177
179
|
key: "batchSearch",
|
|
178
180
|
value: function () {
|
|
179
|
-
var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code,
|
|
180
|
-
var result, resultDiscountList;
|
|
181
|
+
var _batchSearch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(code, options) {
|
|
182
|
+
var _ref, customerId, orderId, result, resultDiscountList;
|
|
181
183
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
182
184
|
while (1) switch (_context5.prev = _context5.next) {
|
|
183
185
|
case 0:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
+
_ref = options || {}, customerId = _ref.customerId, orderId = _ref.orderId;
|
|
187
|
+
_context5.next = 3;
|
|
188
|
+
return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({
|
|
186
189
|
code: code,
|
|
187
190
|
translate_flag: 1,
|
|
188
191
|
tags: ['good_pass', 'product_discount_card'],
|
|
@@ -190,14 +193,17 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
190
193
|
relation_product: 1,
|
|
191
194
|
with: ['extensionData', 'customScheduleSnapshot', 'holder.detail'],
|
|
192
195
|
order_behavior_count: 1,
|
|
193
|
-
order_behavior_count_customer_id: customerId || 1
|
|
196
|
+
order_behavior_count_customer_id: customerId || 1
|
|
197
|
+
}, orderId ? {
|
|
198
|
+
order_behavior_count_order_id: orderId
|
|
199
|
+
} : {}), {}, {
|
|
194
200
|
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
195
|
-
});
|
|
196
|
-
case
|
|
201
|
+
}));
|
|
202
|
+
case 3:
|
|
197
203
|
result = _context5.sent;
|
|
198
204
|
resultDiscountList = this.filterEnabledDiscountList((result === null || result === void 0 ? void 0 : result.data) || []) || [];
|
|
199
205
|
return _context5.abrupt("return", resultDiscountList);
|
|
200
|
-
case
|
|
206
|
+
case 6:
|
|
201
207
|
case "end":
|
|
202
208
|
return _context5.stop();
|
|
203
209
|
}
|
|
@@ -23,7 +23,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
23
23
|
*/
|
|
24
24
|
private logError;
|
|
25
25
|
createOrder(params: CommitOrderParams['query']): {
|
|
26
|
-
type: "
|
|
26
|
+
type: "appointment_booking" | "virtual";
|
|
27
27
|
platform: string;
|
|
28
28
|
sales_channel: string;
|
|
29
29
|
order_sales_channel: string;
|
|
@@ -250,11 +250,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
250
250
|
key: "createOrderByCheckout",
|
|
251
251
|
value: (function () {
|
|
252
252
|
var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
253
|
-
var _params$bookings2, _params$relation_prod2, _params$
|
|
254
|
-
var _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
|
|
253
|
+
var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3, _params$bookings3, _params$relation_prod3, _params$payments4;
|
|
254
|
+
var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, _orderData$bookings2, _orderData$relation_p2, _orderData$payments4, _orderData$payments5, _response$data, orderData, response;
|
|
255
255
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
256
256
|
while (1) switch (_context3.prev = _context3.next) {
|
|
257
257
|
case 0:
|
|
258
|
+
// 过滤掉由在线店铺下单的 payment 支付数据
|
|
259
|
+
onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
|
|
260
|
+
params.payments = (_params$payments = params.payments) === null || _params$payments === void 0 ? void 0 : _params$payments.filter(function (p) {
|
|
261
|
+
return !onlineStorePaymentCodeList.includes(p.code);
|
|
262
|
+
});
|
|
258
263
|
this.logInfo('createOrderByCheckout called', {
|
|
259
264
|
type: params.type,
|
|
260
265
|
platform: params.platform,
|
|
@@ -262,14 +267,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
262
267
|
customer_id: params.customer_id,
|
|
263
268
|
bookingsCount: ((_params$bookings2 = params.bookings) === null || _params$bookings2 === void 0 ? void 0 : _params$bookings2.length) || 0,
|
|
264
269
|
relationProductsCount: ((_params$relation_prod2 = params.relation_products) === null || _params$relation_prod2 === void 0 ? void 0 : _params$relation_prod2.length) || 0,
|
|
265
|
-
paymentsCount: ((_params$
|
|
270
|
+
paymentsCount: ((_params$payments2 = params.payments) === null || _params$payments2 === void 0 ? void 0 : _params$payments2.length) || 0,
|
|
266
271
|
depositAmount: params.deposit_amount,
|
|
267
272
|
productTaxFee: params.product_tax_fee,
|
|
268
273
|
note: params.note,
|
|
269
274
|
scheduleDate: params.schedule_date,
|
|
270
275
|
hasOrderId: !!params.order_id,
|
|
271
276
|
orderIdIncluded: params.order_id,
|
|
272
|
-
paymentMethods: ((_params$
|
|
277
|
+
paymentMethods: ((_params$payments3 = params.payments) === null || _params$payments3 === void 0 ? void 0 : _params$payments3.map(function (p) {
|
|
273
278
|
return p.code;
|
|
274
279
|
})) || []
|
|
275
280
|
});
|
|
@@ -280,9 +285,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
280
285
|
customer_id: params.customer_id,
|
|
281
286
|
bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
|
|
282
287
|
relationProductsCount: ((_params$relation_prod3 = params.relation_products) === null || _params$relation_prod3 === void 0 ? void 0 : _params$relation_prod3.length) || 0,
|
|
283
|
-
paymentsCount: ((_params$
|
|
288
|
+
paymentsCount: ((_params$payments4 = params.payments) === null || _params$payments4 === void 0 ? void 0 : _params$payments4.length) || 0
|
|
284
289
|
});
|
|
285
|
-
_context3.prev =
|
|
290
|
+
_context3.prev = 4;
|
|
286
291
|
// 构建订单数据,设置默认值并允许 params 覆盖
|
|
287
292
|
orderData = _objectSpread({
|
|
288
293
|
sales_channel: 'my_pisel',
|
|
@@ -346,9 +351,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
346
351
|
});
|
|
347
352
|
|
|
348
353
|
// 调用后端接口
|
|
349
|
-
_context3.next =
|
|
354
|
+
_context3.next = 12;
|
|
350
355
|
return this.request.post('/order/checkout', orderData);
|
|
351
|
-
case
|
|
356
|
+
case 12:
|
|
352
357
|
response = _context3.sent;
|
|
353
358
|
this.logInfo('Order API called successfully', {
|
|
354
359
|
response: response
|
|
@@ -358,19 +363,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
358
363
|
hasOrderId: !!(response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.order_id || response !== null && response !== void 0 && response.order_id)
|
|
359
364
|
});
|
|
360
365
|
return _context3.abrupt("return", response);
|
|
361
|
-
case
|
|
362
|
-
_context3.prev =
|
|
363
|
-
_context3.t0 = _context3["catch"](
|
|
366
|
+
case 18:
|
|
367
|
+
_context3.prev = 18;
|
|
368
|
+
_context3.t0 = _context3["catch"](4);
|
|
364
369
|
console.error('[Order] createOrderByCheckout 创建订单失败:', _context3.t0);
|
|
365
370
|
this.logInfo('Order API called failed', {
|
|
366
371
|
error: _context3.t0 instanceof Error ? _context3.t0.message : String(_context3.t0)
|
|
367
372
|
});
|
|
368
373
|
throw _context3.t0;
|
|
369
|
-
case
|
|
374
|
+
case 23:
|
|
370
375
|
case "end":
|
|
371
376
|
return _context3.stop();
|
|
372
377
|
}
|
|
373
|
-
}, _callee3, this, [[
|
|
378
|
+
}, _callee3, this, [[4, 18]]);
|
|
374
379
|
}));
|
|
375
380
|
function createOrderByCheckout(_x4) {
|
|
376
381
|
return _createOrderByCheckout.apply(this, arguments);
|
|
@@ -24,11 +24,14 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
24
24
|
window: WindowPlugin;
|
|
25
25
|
private dbManager;
|
|
26
26
|
private logger;
|
|
27
|
+
private voucherUpdateLockByOrderUuid;
|
|
27
28
|
protected otherParams: any;
|
|
28
29
|
cash: CashPayment;
|
|
29
30
|
eftpos: EftposPayment;
|
|
30
31
|
wallet: WalletPassPayment;
|
|
31
32
|
constructor(name?: string, version?: string);
|
|
33
|
+
private runVoucherUpdateLocked;
|
|
34
|
+
private normalizeVoucherPaymentItems;
|
|
32
35
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
33
36
|
/**
|
|
34
37
|
* 记录信息日志
|
|
@@ -51,6 +54,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
51
54
|
*
|
|
52
55
|
*/
|
|
53
56
|
private registerNetworkHandlers;
|
|
57
|
+
private filterPayMethods;
|
|
54
58
|
/**
|
|
55
59
|
* 获取支付方式列表
|
|
56
60
|
*/
|