@pisell/pisellos 0.0.559 → 0.0.561
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/dataVariant/adapter.d.ts +1 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +15 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +25 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +5 -2
- package/dist/modules/Discount/index.js +21 -1
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +1 -0
- package/dist/modules/Order/index.js +16 -4
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/ProductList/index.js +18 -10
- package/dist/modules/Rules/index.js +10 -1
- package/dist/modules/Schedule/getDateIsInSchedule.js +5 -0
- package/dist/modules/Summary/utils.js +42 -21
- package/dist/solution/ShopDiscount/index.js +16 -15
- package/dist/solution/VenueBooking/index.d.ts +1 -0
- package/dist/solution/VenueBooking/index.js +52 -36
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/smartPricing.js +6 -6
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +1 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +10 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +20 -1
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +5 -2
- package/lib/modules/Discount/index.js +11 -1
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +1 -0
- package/lib/modules/Order/index.js +11 -1
- package/lib/modules/Order/types.d.ts +2 -0
- package/lib/modules/ProductList/index.js +9 -2
- package/lib/modules/Rules/index.js +6 -1
- package/lib/modules/Schedule/getDateIsInSchedule.js +4 -0
- package/lib/modules/Summary/utils.js +23 -3
- package/lib/solution/ShopDiscount/index.js +3 -2
- package/lib/solution/VenueBooking/index.d.ts +1 -0
- package/lib/solution/VenueBooking/index.js +15 -3
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/smartPricing.js +1 -1
- package/package.json +1 -1
|
@@ -527,7 +527,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
527
527
|
try {
|
|
528
528
|
const orderId = this.store.orderId;
|
|
529
529
|
const customerId = params.customerId || ((_a = this.getCustomer()) == null ? void 0 : _a.id);
|
|
530
|
-
const
|
|
530
|
+
const prepareConfig = await ((_b = this.store.discount) == null ? void 0 : _b.loadPrepareConfig({
|
|
531
531
|
customer_id: customerId,
|
|
532
532
|
action: orderId ? "edit" : "create",
|
|
533
533
|
with_good_pass: 1,
|
|
@@ -536,11 +536,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
536
536
|
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
537
537
|
...orderId ? { order_id: orderId } : {}
|
|
538
538
|
}));
|
|
539
|
+
const goodPassList = (prepareConfig == null ? void 0 : prepareConfig.discountList) || [];
|
|
539
540
|
const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
|
|
540
541
|
(item) => item.isScan
|
|
541
542
|
);
|
|
542
543
|
const scanDiscountIds = scanDiscount.map((n) => n.id);
|
|
543
|
-
const newGoodPassList = goodPassList
|
|
544
|
+
const newGoodPassList = goodPassList.filter((n) => !scanDiscountIds.includes(n.id));
|
|
544
545
|
const newDiscountList = [...scanDiscount, ...newGoodPassList || []];
|
|
545
546
|
this.store.originalDiscountList = newDiscountList;
|
|
546
547
|
await ((_d = this.store.discount) == null ? void 0 : _d.setOriginalDiscountList(newDiscountList));
|
|
@@ -84,6 +84,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
84
84
|
private clearSlotPriceMapCache;
|
|
85
85
|
/** 读取当前登录 customerId */
|
|
86
86
|
private resolveCustomerIdForSmartPricing;
|
|
87
|
+
private resolveAvailableWalletIdsForSmartPricing;
|
|
87
88
|
/** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
|
|
88
89
|
private getScheduleListForSmartPricing;
|
|
89
90
|
/** 构建智能定价上下文,对齐 OS Server buildProductFormatterContext */
|
|
@@ -342,6 +342,9 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
342
342
|
this.customerLoginRefreshIdInFlight = params.customerId;
|
|
343
343
|
const refreshTask = (async () => {
|
|
344
344
|
var _a;
|
|
345
|
+
await this.store.order.loadDiscountConfig({
|
|
346
|
+
customerId: params.customerId
|
|
347
|
+
});
|
|
345
348
|
this.clearSlotPriceMapCache();
|
|
346
349
|
this.recalculateOrderPricesFromSmartPricing();
|
|
347
350
|
if (this.store.holder) {
|
|
@@ -355,9 +358,6 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
355
358
|
channel: (_a = this.otherParams) == null ? void 0 : _a.channel
|
|
356
359
|
});
|
|
357
360
|
}
|
|
358
|
-
await this.store.order.loadDiscountConfig({
|
|
359
|
-
customerId: params.customerId
|
|
360
|
-
});
|
|
361
361
|
await this.store.order.recalculateSummary({ createIfMissing: true });
|
|
362
362
|
this.store.order.persistTempOrder();
|
|
363
363
|
await this.refreshItemRuleQuantityLimits();
|
|
@@ -624,6 +624,16 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
624
624
|
return void 0;
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
+
resolveAvailableWalletIdsForSmartPricing() {
|
|
628
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
629
|
+
const orderWalletIds = (_b = (_a = this.store.order) == null ? void 0 : _a.getAvailableWalletIds) == null ? void 0 : _b.call(_a);
|
|
630
|
+
const fallbackWalletIds = ((_c = this.otherParams) == null ? void 0 : _c.available_wallet_ids) || ((_d = this.otherParams) == null ? void 0 : _d.availableWalletIds) || ((_f = (_e = this.otherParams) == null ? void 0 : _e.strategy_context) == null ? void 0 : _f.available_wallet_ids) || ((_h = (_g = this.otherParams) == null ? void 0 : _g.strategy_context) == null ? void 0 : _h.availableWalletIds);
|
|
631
|
+
const source = Array.isArray(orderWalletIds) && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
|
|
632
|
+
if (!Array.isArray(source))
|
|
633
|
+
return [];
|
|
634
|
+
const ids = source.map((item) => Number(item)).filter((item) => Number.isFinite(item) && item > 0);
|
|
635
|
+
return Array.from(new Set(ids));
|
|
636
|
+
}
|
|
627
637
|
/** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
|
|
628
638
|
getScheduleListForSmartPricing() {
|
|
629
639
|
var _a;
|
|
@@ -640,6 +650,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
640
650
|
scheduleList: this.getScheduleListForSmartPricing(),
|
|
641
651
|
menuList: ((_c = this.otherParams) == null ? void 0 : _c.menuList) || ((_e = (_d = this.otherParams) == null ? void 0 : _d.openData) == null ? void 0 : _e.menuList) || [],
|
|
642
652
|
customerId: customerId ?? this.resolveCustomerIdForSmartPricing(),
|
|
653
|
+
availableWalletIds: this.resolveAvailableWalletIdsForSmartPricing(),
|
|
643
654
|
channel: (_f = this.otherParams) == null ? void 0 : _f.channel,
|
|
644
655
|
businessCode: (_g = this.otherParams) == null ? void 0 : _g.businessCode,
|
|
645
656
|
orderType: ((_h = this.otherParams) == null ? void 0 : _h.orderType) || ((_i = this.otherParams) == null ? void 0 : _i.type),
|
|
@@ -659,6 +670,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
659
670
|
return [
|
|
660
671
|
date,
|
|
661
672
|
context.customerId ?? "",
|
|
673
|
+
(context.availableWalletIds || []).join(","),
|
|
662
674
|
context.channel ?? "",
|
|
663
675
|
context.businessCode ?? ""
|
|
664
676
|
].join("|");
|
|
@@ -10,6 +10,7 @@ export interface VenueBookingSmartPricingContext {
|
|
|
10
10
|
scheduleList?: ScheduleItem[];
|
|
11
11
|
menuList?: DataVariantMenu[];
|
|
12
12
|
customerId?: number | string;
|
|
13
|
+
availableWalletIds?: Array<number | string>;
|
|
13
14
|
channel?: string;
|
|
14
15
|
businessCode?: string;
|
|
15
16
|
orderType?: string;
|
|
@@ -57,6 +57,7 @@ function buildDataVariantBusinessData(products, context, scheduleDateTime) {
|
|
|
57
57
|
scheduleList: context.scheduleList || [],
|
|
58
58
|
menuList: context.menuList || [],
|
|
59
59
|
customerId: context.customerId,
|
|
60
|
+
availableWalletIds: context.availableWalletIds ?? strategyContext.available_wallet_ids ?? strategyContext.availableWalletIds,
|
|
60
61
|
channel: context.channel ?? strategyContext.channel,
|
|
61
62
|
orderType: context.orderType ?? strategyContext.orderType ?? strategyContext.order_type,
|
|
62
63
|
businessCode: context.businessCode ?? strategyContext.business_code ?? strategyContext.businessCode,
|
|
@@ -71,7 +72,6 @@ function formatProductsWithDataVariant(products, context, scheduleDateTime) {
|
|
|
71
72
|
}
|
|
72
73
|
const resolvedAt = scheduleDateTime || (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
73
74
|
const businessData = buildDataVariantBusinessData(products, context, resolvedAt);
|
|
74
|
-
console.log(businessData, "businessData");
|
|
75
75
|
const result = evaluator.resolveProducts(businessData);
|
|
76
76
|
return Array.isArray(result == null ? void 0 : result.products) ? result.products : products;
|
|
77
77
|
}
|