@pisell/pisellos 2.3.128 → 2.3.129
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/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/Order/index.d.ts +6 -0
- package/dist/modules/Order/index.js +443 -235
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +1 -1
- package/dist/modules/Order/utils.js +101 -60
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/solution/BaseSales/index.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +5 -2
- package/dist/solution/BaseSales/types.d.ts +2 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingTicket/index.d.ts +1 -2
- package/dist/solution/BookingTicket/index.js +60 -63
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.js +2 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/Order/index.d.ts +6 -0
- package/lib/modules/Order/index.js +213 -40
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +1 -1
- package/lib/modules/Order/utils.js +39 -3
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/solution/BaseSales/index.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +5 -2
- package/lib/solution/BaseSales/types.d.ts +2 -2
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingTicket/index.d.ts +1 -2
- package/lib/solution/BookingTicket/index.js +36 -33
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.js +2 -2
- package/package.json +1 -1
|
@@ -29,6 +29,7 @@ import { uniqueById } from "../../solution/ShopDiscount/utils";
|
|
|
29
29
|
import { BaseModule } from "../BaseModule";
|
|
30
30
|
import { DiscountHooks } from "./types";
|
|
31
31
|
import Decimal from 'decimal.js';
|
|
32
|
+
import { getDiscountLifecycleReason, getDiscountUsageBlockReason, getDiscountUsageLimitFailKey, hasAvailableDiscountBalance } from "./availability";
|
|
32
33
|
export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
33
34
|
_inherits(DiscountModule, _BaseModule);
|
|
34
35
|
var _super = _createSuper(DiscountModule);
|
|
@@ -165,8 +166,8 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
165
166
|
key: "loadPrepareConfig",
|
|
166
167
|
value: function () {
|
|
167
168
|
var _loadPrepareConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
168
|
-
var _params$with_availabl, _params$with_availabl2, _params$with_virtual_, _prepareConfig$data, _prepareConfig$data2, _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5, _prepareConfig$data6;
|
|
169
|
-
var prepareConfig, rawDiscountList, availableWalletList, availableWalletPassList, availableWalletIds, virtualCurrencyList, goodPassList;
|
|
169
|
+
var _params$with_availabl, _params$with_availabl2, _params$with_virtual_, _prepareConfig$data, _prepareConfig$data2, _prepareConfig$data3, _prepareConfig$data4, _prepareConfig$data5, _prepareConfig$data6, _prepareConfig$data7;
|
|
170
|
+
var prepareConfig, entitlementPassList, entitlementPassIds, excludeEntitlementDuplicates, rawDiscountList, availableWalletList, availableWalletPassList, availableWalletIds, virtualCurrencyList, goodPassList;
|
|
170
171
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
171
172
|
while (1) switch (_context4.prev = _context4.next) {
|
|
172
173
|
case 0:
|
|
@@ -181,15 +182,27 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
181
182
|
}));
|
|
182
183
|
case 3:
|
|
183
184
|
prepareConfig = _context4.sent;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
entitlementPassList = (prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data = prepareConfig.data) === null || _prepareConfig$data === void 0 ? void 0 : _prepareConfig$data.entitlement_pass_list) || [];
|
|
186
|
+
entitlementPassIds = new Set(entitlementPassList.map(function (discount) {
|
|
187
|
+
return discount === null || discount === void 0 ? void 0 : discount.id;
|
|
188
|
+
}).filter(function (id) {
|
|
189
|
+
return id !== undefined && id !== null;
|
|
190
|
+
}).map(function (id) {
|
|
191
|
+
return String(id);
|
|
192
|
+
}));
|
|
193
|
+
excludeEntitlementDuplicates = function excludeEntitlementDuplicates(discount) {
|
|
194
|
+
var id = discount === null || discount === void 0 ? void 0 : discount.id;
|
|
195
|
+
return id === undefined || id === null || !entitlementPassIds.has(String(id));
|
|
196
|
+
};
|
|
197
|
+
rawDiscountList = [].concat(_toConsumableArray(entitlementPassList), _toConsumableArray(((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data2 = prepareConfig.data) === null || _prepareConfig$data2 === void 0 ? void 0 : _prepareConfig$data2.good_pass_list) || []).filter(excludeEntitlementDuplicates)), _toConsumableArray(((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data3 = prepareConfig.data) === null || _prepareConfig$data3 === void 0 ? void 0 : _prepareConfig$data3.discount_card_list) || []).filter(excludeEntitlementDuplicates)));
|
|
198
|
+
availableWalletList = [].concat(_toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data4 = prepareConfig.data) === null || _prepareConfig$data4 === void 0 ? void 0 : _prepareConfig$data4.avaiable_wallet_list) || []), _toConsumableArray((prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data5 = prepareConfig.data) === null || _prepareConfig$data5 === void 0 ? void 0 : _prepareConfig$data5.available_wallet_list) || []));
|
|
199
|
+
availableWalletPassList = (prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data6 = prepareConfig.data) === null || _prepareConfig$data6 === void 0 ? void 0 : _prepareConfig$data6.available_wallet_pass_list) || [];
|
|
187
200
|
availableWalletIds = this.normalizePositiveNumberIds([].concat(_toConsumableArray(availableWalletList.map(function (item) {
|
|
188
201
|
return item === null || item === void 0 ? void 0 : item.wallet_id;
|
|
189
202
|
})), _toConsumableArray(availableWalletPassList.map(function (item) {
|
|
190
203
|
return item === null || item === void 0 ? void 0 : item.product_id;
|
|
191
204
|
}))));
|
|
192
|
-
virtualCurrencyList = this.normalizeVirtualCurrencyList(prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$
|
|
205
|
+
virtualCurrencyList = this.normalizeVirtualCurrencyList(prepareConfig === null || prepareConfig === void 0 || (_prepareConfig$data7 = prepareConfig.data) === null || _prepareConfig$data7 === void 0 ? void 0 : _prepareConfig$data7.virtual_currency_list);
|
|
193
206
|
goodPassList = this.filterEnabledDiscountList(rawDiscountList) || []; // this.setDiscountList(goodPassList);
|
|
194
207
|
return _context4.abrupt("return", {
|
|
195
208
|
discountList: goodPassList,
|
|
@@ -199,7 +212,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
199
212
|
return _objectSpread({}, item || {});
|
|
200
213
|
})
|
|
201
214
|
});
|
|
202
|
-
case
|
|
215
|
+
case 14:
|
|
203
216
|
case "end":
|
|
204
217
|
return _context4.stop();
|
|
205
218
|
}
|
|
@@ -253,7 +266,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
253
266
|
return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({
|
|
254
267
|
code: code,
|
|
255
268
|
translate_flag: 1,
|
|
256
|
-
tags: ['good_pass', 'product_discount_card'],
|
|
269
|
+
tags: ['entitlement_pass', 'good_pass', 'product_discount_card'],
|
|
257
270
|
// available: 1,
|
|
258
271
|
relation_product: 1,
|
|
259
272
|
with: ['extensionData', 'customScheduleSnapshot', 'holder.detail'],
|
|
@@ -292,8 +305,11 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
292
305
|
return this.request.get("/machinecode/batch-search", {
|
|
293
306
|
ids: productIds,
|
|
294
307
|
translate_flag: 1,
|
|
295
|
-
tags: ['good_pass', 'product_discount_card'],
|
|
296
|
-
relation_product: 1
|
|
308
|
+
tags: ['entitlement_pass', 'good_pass', 'product_discount_card'],
|
|
309
|
+
relation_product: 1,
|
|
310
|
+
with: ['extensionData', 'customScheduleSnapshot', 'holder.detail'],
|
|
311
|
+
unified_status_info_flag: 1,
|
|
312
|
+
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
297
313
|
});
|
|
298
314
|
case 2:
|
|
299
315
|
result = _context6.sent;
|
|
@@ -308,160 +324,30 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
308
324
|
return _batchSearchByProductIds.apply(this, arguments);
|
|
309
325
|
}
|
|
310
326
|
return batchSearchByProductIds;
|
|
311
|
-
}()
|
|
327
|
+
}() // 展示列表只剔除已失效项,当前不可用项保留并携带原因。
|
|
312
328
|
}, {
|
|
313
329
|
key: "filterEnabledDiscountList",
|
|
314
330
|
value: function filterEnabledDiscountList(discountList) {
|
|
315
|
-
var _this2 = this;
|
|
316
331
|
return discountList.filter(function (discount) {
|
|
317
|
-
return discount.limit_status === 'enable' &&
|
|
332
|
+
return discount.limit_status === 'enable' && hasAvailableDiscountBalance(discount) && !getDiscountLifecycleReason(discount);
|
|
333
|
+
}).map(function (discount) {
|
|
334
|
+
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
335
|
+
usageLimitFailKey: getDiscountUsageLimitFailKey(discount),
|
|
336
|
+
reasonCode: getDiscountUsageBlockReason(discount)
|
|
337
|
+
});
|
|
318
338
|
});
|
|
319
339
|
}
|
|
320
|
-
|
|
321
|
-
// 检查使用次数限制
|
|
322
|
-
}, {
|
|
323
|
-
key: "checkUsageCreditsLimit",
|
|
324
|
-
value: function checkUsageCreditsLimit(discount) {
|
|
325
|
-
// 如果没有 extension_data,则不需要限制
|
|
326
|
-
if (!discount.extension_data || discount.extension_data.length === 0) {
|
|
327
|
-
return true;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// 查找 field_key 为 usage_credits 的数据
|
|
331
|
-
var usageCreditsData = discount.extension_data.find(function (data) {
|
|
332
|
-
return data.field_key === 'usage_credits';
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
// 如果没有找到 usage_credits 数据,则不需要限制
|
|
336
|
-
if (!usageCreditsData) {
|
|
337
|
-
return true;
|
|
338
|
-
}
|
|
339
|
-
var value = usageCreditsData.value;
|
|
340
|
-
|
|
341
|
-
// 检查总次数限制
|
|
342
|
-
if (value.total_credits && value.total_credits > 0) {
|
|
343
|
-
if ((discount.total_order_behavior_count || 0) >= value.total_credits) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// 检查单用户限制
|
|
349
|
-
if (value.per_user_limit && value.per_user_limit > 0) {
|
|
350
|
-
if ((discount.customer_order_behavior_count || 0) >= value.per_user_limit) {
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// 检查单日限制
|
|
356
|
-
if (value.max_per_day && value.max_per_day > 0) {
|
|
357
|
-
if ((discount.today_order_behavior_count || 0) >= value.max_per_day) {
|
|
358
|
-
return false;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// 检查单周限制
|
|
363
|
-
if (value.max_per_week && value.max_per_week > 0) {
|
|
364
|
-
if ((discount.week_order_behavior_count || 0) >= value.max_per_week) {
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// 检查单月限制
|
|
370
|
-
if (value.max_per_month && value.max_per_month > 0) {
|
|
371
|
-
if ((discount.month_order_behavior_count || 0) >= value.max_per_month) {
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// 所有检查都通过
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// 过滤启用且可用的优惠券,并返回校验失败原因
|
|
381
340
|
}, {
|
|
382
341
|
key: "filterEnabledDiscountListWithReason",
|
|
383
342
|
value: function filterEnabledDiscountListWithReason(discountList) {
|
|
384
|
-
var _this3 = this;
|
|
385
|
-
var lists = discountList.filter(function (discount) {
|
|
386
|
-
return discount.limit_status === 'enable';
|
|
387
|
-
}).filter(function (discount) {
|
|
388
|
-
var remaining = new Decimal((discount === null || discount === void 0 ? void 0 : discount.par_value) || 0).minus(new Decimal((discount === null || discount === void 0 ? void 0 : discount.used_par_value) || 0)).greaterThan(0);
|
|
389
|
-
return remaining;
|
|
390
|
-
}).map(function (discount) {
|
|
391
|
-
var limitFailKey = _this3.checkUsageCreditsLimitWithFailKey(discount);
|
|
392
|
-
return _objectSpread(_objectSpread({}, discount), {}, {
|
|
393
|
-
usageLimitFailKey: limitFailKey
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
|
|
397
|
-
// 可用的列表
|
|
398
|
-
var availableLists = lists.filter(function (item) {
|
|
399
|
-
return !item.usageLimitFailKey && item.unified_available_status !== 0;
|
|
400
|
-
});
|
|
401
|
-
// 不可用数据
|
|
402
|
-
var currentFailDiscount = lists.find(function (item) {
|
|
403
|
-
return item.usageLimitFailKey;
|
|
404
|
-
});
|
|
405
343
|
return {
|
|
406
|
-
discountList:
|
|
407
|
-
unavailableReasonKey:
|
|
344
|
+
discountList: this.filterEnabledDiscountList(discountList),
|
|
345
|
+
unavailableReasonKey: discountList.map(getDiscountUsageLimitFailKey).find(function (key) {
|
|
346
|
+
return key !== null;
|
|
347
|
+
}) || null
|
|
408
348
|
};
|
|
409
349
|
}
|
|
410
350
|
|
|
411
|
-
// 检查使用次数限制,并返回校验失败原因
|
|
412
|
-
}, {
|
|
413
|
-
key: "checkUsageCreditsLimitWithFailKey",
|
|
414
|
-
value: function checkUsageCreditsLimitWithFailKey(discount) {
|
|
415
|
-
if (!discount.extension_data || discount.extension_data.length === 0) {
|
|
416
|
-
return null;
|
|
417
|
-
}
|
|
418
|
-
var usageCreditsData = discount.extension_data.find(function (data) {
|
|
419
|
-
return data.field_key === 'usage_credits';
|
|
420
|
-
});
|
|
421
|
-
if (!usageCreditsData) {
|
|
422
|
-
return null;
|
|
423
|
-
}
|
|
424
|
-
var value = usageCreditsData.value;
|
|
425
|
-
|
|
426
|
-
// 总次数限制
|
|
427
|
-
if (value.total_credits && value.total_credits > 0) {
|
|
428
|
-
if ((discount.total_order_behavior_count || 0) >= value.total_credits) {
|
|
429
|
-
return 'total_credits';
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// 单用户限制
|
|
434
|
-
if (value.per_user_limit && value.per_user_limit > 0) {
|
|
435
|
-
if ((discount.customer_order_behavior_count || 0) >= value.per_user_limit) {
|
|
436
|
-
return 'per_user_limit';
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// 单日限制
|
|
441
|
-
if (value.max_per_day && value.max_per_day > 0) {
|
|
442
|
-
if ((discount.today_order_behavior_count || 0) >= value.max_per_day) {
|
|
443
|
-
return 'max_per_day';
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
// 单周限制
|
|
448
|
-
if (value.max_per_week && value.max_per_week > 0) {
|
|
449
|
-
if ((discount.week_order_behavior_count || 0) >= value.max_per_week) {
|
|
450
|
-
return 'max_per_week';
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// 单月限制
|
|
455
|
-
if (value.max_per_month && value.max_per_month > 0) {
|
|
456
|
-
if ((discount.month_order_behavior_count || 0) >= value.max_per_month) {
|
|
457
|
-
return 'max_per_month';
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// 全部通过
|
|
462
|
-
return null;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
351
|
// 根据productIds去重
|
|
466
352
|
}, {
|
|
467
353
|
key: "uniqueByProductId",
|
|
@@ -44,7 +44,10 @@ interface ApplicableProductDetails {
|
|
|
44
44
|
original_amount: string;
|
|
45
45
|
num: number;
|
|
46
46
|
metadata?: {
|
|
47
|
+
encoded?: string;
|
|
47
48
|
product_discount_difference?: number;
|
|
49
|
+
/** 月卡扣除本单新增使用后的剩余次数;不限次数时为 null。 */
|
|
50
|
+
balance?: number | null;
|
|
48
51
|
};
|
|
49
52
|
discount?: {
|
|
50
53
|
fixed_amount?: number;
|
|
@@ -63,6 +66,13 @@ interface UsageCreditsValue {
|
|
|
63
66
|
max_per_week: number;
|
|
64
67
|
max_per_month: number;
|
|
65
68
|
}
|
|
69
|
+
export type IncludedUses = {
|
|
70
|
+
type: 'limited';
|
|
71
|
+
value: number;
|
|
72
|
+
} | {
|
|
73
|
+
type: 'unlimited';
|
|
74
|
+
value: null;
|
|
75
|
+
};
|
|
66
76
|
export type DiscountFilterRejectKey = 'total_credits' | 'per_user_limit' | 'max_per_day' | 'max_per_week' | 'max_per_month';
|
|
67
77
|
export interface DiscountWithReason {
|
|
68
78
|
discountList: Discount[];
|
|
@@ -107,30 +117,37 @@ interface ExtensionData {
|
|
|
107
117
|
}
|
|
108
118
|
export interface Discount {
|
|
109
119
|
id: number;
|
|
120
|
+
shop_id?: number;
|
|
110
121
|
product_name: string;
|
|
111
122
|
encoded: string;
|
|
112
123
|
code: string;
|
|
113
124
|
tag: string;
|
|
114
|
-
expire_time?: string;
|
|
125
|
+
expire_time?: string | null;
|
|
126
|
+
expire_date?: string | null;
|
|
127
|
+
end_time?: string | null;
|
|
115
128
|
product_id: number;
|
|
116
129
|
relation_type: string;
|
|
117
130
|
par_value: string;
|
|
118
131
|
used_par_value: string;
|
|
119
132
|
limit_status: string;
|
|
120
133
|
limited_relation_product_data: Limitedrelationproductdata;
|
|
121
|
-
balance
|
|
134
|
+
balance?: string | number | null;
|
|
135
|
+
available_num?: number;
|
|
136
|
+
available_products_info?: any[];
|
|
122
137
|
format_title: Formattitle;
|
|
123
138
|
metadata?: {
|
|
139
|
+
encoded?: string;
|
|
124
140
|
discount_card_type?: 'fixed_amount' | 'percent';
|
|
125
141
|
custom_product_bundle_map_id?: string;
|
|
126
142
|
validity_type?: "custom_schedule_validity" | "fixed_validity";
|
|
127
|
-
|
|
128
|
-
|
|
143
|
+
included_uses?: IncludedUses;
|
|
144
|
+
discount_calculation_mode?: 'item_level' | 'order_level';
|
|
145
|
+
holder?: {
|
|
129
146
|
type: "customer" | "custom";
|
|
130
147
|
};
|
|
131
148
|
};
|
|
132
149
|
product: Product;
|
|
133
|
-
type
|
|
150
|
+
type?: "product" | 'good_pass' | 'entitlement_pass' | 'discount_card' | 'product_discount_card';
|
|
134
151
|
resource_id?: number;
|
|
135
152
|
savedAmount?: number;
|
|
136
153
|
isEditMode?: boolean;
|
|
@@ -163,9 +180,17 @@ export interface Discount {
|
|
|
163
180
|
applicableProductIds?: number[];
|
|
164
181
|
applicableProductDetails: ApplicableProductDetails[];
|
|
165
182
|
appliedProductDetails: ApplicableProductDetails[];
|
|
183
|
+
/** Entitlement Pass 编辑订单时已经提交的使用明细。 */
|
|
184
|
+
committedAppliedProductDetails?: ApplicableProductDetails[];
|
|
166
185
|
isDisabledForProductUsed?: boolean;
|
|
167
186
|
amount?: number;
|
|
168
187
|
customer_id?: number | string | null;
|
|
188
|
+
holder?: {
|
|
189
|
+
holder_type?: 'customer' | 'form' | string;
|
|
190
|
+
holder_id?: number | string | Array<number | string>;
|
|
191
|
+
created_at?: string | null;
|
|
192
|
+
[key: string]: any;
|
|
193
|
+
};
|
|
169
194
|
extension_data?: ExtensionData[];
|
|
170
195
|
total_order_behavior_count?: number;
|
|
171
196
|
today_order_behavior_count?: number;
|
|
@@ -180,6 +205,12 @@ export interface Discount {
|
|
|
180
205
|
start_time?: string;
|
|
181
206
|
discount_rule_uncheck_flag?: boolean;
|
|
182
207
|
usageLimitFailKey?: string | null;
|
|
208
|
+
/** 本次规则计算的不可用原因;可用性恢复后清除。 */
|
|
209
|
+
reason?: string;
|
|
210
|
+
reasonCode?: string;
|
|
211
|
+
unified_messages?: {
|
|
212
|
+
title?: string | Record<string, string>;
|
|
213
|
+
};
|
|
183
214
|
unified_available_status?: number | undefined | null;
|
|
184
215
|
}
|
|
185
216
|
export interface DiscountState {
|
|
@@ -111,6 +111,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
111
111
|
applyDiscount(options?: {
|
|
112
112
|
reapplyBookingDiscountProductUids?: string[];
|
|
113
113
|
reapplyWeighedDiscountProductUids?: string[];
|
|
114
|
+
preferredEntitlementPassIds?: number[];
|
|
114
115
|
}): void;
|
|
115
116
|
/**
|
|
116
117
|
* 注入促销评估器。
|
|
@@ -489,7 +490,12 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
489
490
|
}>, options?: {
|
|
490
491
|
skipEditDiscountConfigRefresh?: boolean;
|
|
491
492
|
}): Promise<OrderProduct[]>;
|
|
493
|
+
private getFullCoveragePassDiscounts;
|
|
494
|
+
private hasEntitlementPassDiscount;
|
|
492
495
|
private hasGoodPassDiscount;
|
|
496
|
+
private isPersistedProductLine;
|
|
497
|
+
private isRuntimeEntitlementAppend;
|
|
498
|
+
private hasSameEntitlementMergePriceConfig;
|
|
493
499
|
private getBundleRuntimeIdentity;
|
|
494
500
|
private preservePersistedBundlePriceFields;
|
|
495
501
|
private applyOrderProductUpdateToTempOrder;
|