@pisell/pisellos 2.1.165 → 2.1.166
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/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +167 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +780 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +5 -1
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- 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 +18 -6
- package/dist/modules/Order/types.d.ts +2 -0
- package/dist/modules/ProductList/index.d.ts +3 -1
- package/dist/modules/ProductList/index.js +22 -11
- package/dist/modules/Schedule/getDateIsInSchedule.js +5 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/index.js +1 -1
- package/dist/solution/ShopDiscount/index.js +16 -15
- package/dist/solution/VenueBooking/index.d.ts +40 -3
- package/dist/solution/VenueBooking/index.js +394 -261
- package/dist/solution/VenueBooking/types.d.ts +3 -1
- package/dist/solution/VenueBooking/types.js +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +12 -25
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -6
- package/dist/solution/VenueBooking/utils/slotMerge.js +3 -9
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +70 -0
- package/dist/solution/VenueBooking/utils/smartPricing.js +233 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +2 -0
- package/dist/solution/VenueBooking/utils/timeSlot.js +9 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +149 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +583 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +13 -2
- 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.d.ts +3 -1
- package/lib/modules/ProductList/index.js +45 -39
- package/lib/modules/Schedule/getDateIsInSchedule.js +4 -0
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/index.js +1 -1
- package/lib/solution/ShopDiscount/index.js +3 -2
- package/lib/solution/VenueBooking/index.d.ts +40 -3
- package/lib/solution/VenueBooking/index.js +257 -111
- package/lib/solution/VenueBooking/types.d.ts +3 -1
- package/lib/solution/VenueBooking/types.js +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +5 -10
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -6
- package/lib/solution/VenueBooking/utils/slotMerge.js +3 -4
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +70 -0
- package/lib/solution/VenueBooking/utils/smartPricing.js +180 -0
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +2 -0
- package/lib/solution/VenueBooking/utils/timeSlot.js +7 -3
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
11
11
|
constructor(name?: string, version?: string);
|
|
12
12
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
13
13
|
storeChange(path?: string, value?: any): Promise<void>;
|
|
14
|
-
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
|
|
14
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, with_extra, }: {
|
|
15
15
|
category_ids?: number[];
|
|
16
16
|
product_ids?: number[];
|
|
17
17
|
collection?: number | string[];
|
|
@@ -22,6 +22,8 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
22
22
|
menu_list_ids?: number[];
|
|
23
23
|
with_count?: string[];
|
|
24
24
|
with_schedule?: number;
|
|
25
|
+
/** 追加到默认 with 字段(如 dataVariants) */
|
|
26
|
+
with_extra?: string[];
|
|
25
27
|
}): Promise<any>;
|
|
26
28
|
loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
|
|
27
29
|
ids?: number[];
|
|
@@ -59,7 +59,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
59
59
|
schedule_datetime,
|
|
60
60
|
schedule_date,
|
|
61
61
|
cacheId,
|
|
62
|
-
with_schedule
|
|
62
|
+
with_schedule,
|
|
63
|
+
with_extra = []
|
|
63
64
|
}) {
|
|
64
65
|
var _a;
|
|
65
66
|
let userPlugin = this.core.getPlugin("user");
|
|
@@ -69,44 +70,49 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
69
70
|
} catch (error) {
|
|
70
71
|
console.error(error);
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
73
|
+
try {
|
|
74
|
+
const productsData = await this.request.post(
|
|
75
|
+
`/product/query`,
|
|
76
|
+
{
|
|
77
|
+
open_quotation: 1,
|
|
78
|
+
open_bundle: 0,
|
|
79
|
+
exclude_extension_type: [
|
|
80
|
+
"product_party",
|
|
81
|
+
"product_event",
|
|
82
|
+
"product_series_event",
|
|
83
|
+
"product_package_ticket",
|
|
84
|
+
"ticket",
|
|
85
|
+
"event_item"
|
|
86
|
+
],
|
|
87
|
+
with: ["category", "collection", "resourceRelation", ...with_extra],
|
|
88
|
+
status: "published",
|
|
89
|
+
num: 500,
|
|
90
|
+
skip: 1,
|
|
91
|
+
customer_id,
|
|
92
|
+
category_ids,
|
|
93
|
+
ids: product_ids,
|
|
94
|
+
collection,
|
|
95
|
+
front_end_cache_id: cacheId,
|
|
96
|
+
with_count,
|
|
97
|
+
// client_schedule_ids: schedule_ids,
|
|
98
|
+
schedule_date,
|
|
99
|
+
schedule_datetime,
|
|
100
|
+
// application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
|
|
101
|
+
application_code: "online-store",
|
|
102
|
+
with_schedule,
|
|
103
|
+
is_eject: 1,
|
|
104
|
+
menu_list_ids,
|
|
105
|
+
open_deposit: 1
|
|
106
|
+
},
|
|
107
|
+
{ useCache: true, customToast: () => {
|
|
108
|
+
} }
|
|
109
|
+
);
|
|
110
|
+
const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
111
|
+
this.addProduct(sortedList);
|
|
112
|
+
return sortedList;
|
|
113
|
+
} catch (error) {
|
|
114
|
+
return error;
|
|
115
|
+
}
|
|
110
116
|
}
|
|
111
117
|
async loadProductsPrice({
|
|
112
118
|
ids = [],
|
|
@@ -34,6 +34,10 @@ __export(getDateIsInSchedule_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(getDateIsInSchedule_exports);
|
|
36
36
|
var import_dayjs = __toESM(require("dayjs"));
|
|
37
|
+
var import_isSameOrAfter = __toESM(require("dayjs/plugin/isSameOrAfter"));
|
|
38
|
+
var import_isSameOrBefore = __toESM(require("dayjs/plugin/isSameOrBefore"));
|
|
39
|
+
import_dayjs.default.extend(import_isSameOrAfter.default);
|
|
40
|
+
import_dayjs.default.extend(import_isSameOrBefore.default);
|
|
37
41
|
var getDateIsInSchedule = (dateTime, scheduleList) => {
|
|
38
42
|
if (!dateTime || !scheduleList || scheduleList.length === 0) {
|
|
39
43
|
return false;
|
|
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
310
310
|
date: string;
|
|
311
311
|
status: string;
|
|
312
312
|
week: string;
|
|
313
|
-
weekNum: 0 |
|
|
313
|
+
weekNum: 0 | 1 | 5 | 4 | 2 | 3 | 6;
|
|
314
314
|
}[]>;
|
|
315
315
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
316
316
|
private getScheduleDataByIds;
|
|
@@ -329,7 +329,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
329
329
|
count: number;
|
|
330
330
|
left: number;
|
|
331
331
|
summaryCount: number;
|
|
332
|
-
status: "
|
|
332
|
+
status: "sold_out" | "lots_of_space" | "filling_up_fast";
|
|
333
333
|
}[];
|
|
334
334
|
/**
|
|
335
335
|
* 找到多个资源的公共可用时间段
|
|
@@ -563,7 +563,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
|
|
|
563
563
|
...tempOrder.metadata || {},
|
|
564
564
|
shop_service_data: {
|
|
565
565
|
...(tempOrder.metadata || {}).shop_service_data || {},
|
|
566
|
-
service_type: ((_a = this.otherParams) == null ? void 0 : _a.businessCode) === "dine_in" ? "dine_in" : "
|
|
566
|
+
service_type: ((_a = this.otherParams) == null ? void 0 : _a.businessCode) === "dine_in" ? "dine_in" : "",
|
|
567
567
|
pickup_reference_mode: mode
|
|
568
568
|
}
|
|
569
569
|
};
|
|
@@ -511,7 +511,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
511
511
|
try {
|
|
512
512
|
const orderId = this.store.orderId;
|
|
513
513
|
const customerId = params.customerId || ((_a = this.getCustomer()) == null ? void 0 : _a.id);
|
|
514
|
-
const
|
|
514
|
+
const prepareConfig = await ((_b = this.store.discount) == null ? void 0 : _b.loadPrepareConfig({
|
|
515
515
|
customer_id: customerId,
|
|
516
516
|
action: orderId ? "edit" : "create",
|
|
517
517
|
with_good_pass: 1,
|
|
@@ -520,11 +520,12 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
520
520
|
request_timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
521
521
|
...orderId ? { order_id: orderId } : {}
|
|
522
522
|
}));
|
|
523
|
+
const goodPassList = (prepareConfig == null ? void 0 : prepareConfig.discountList) || [];
|
|
523
524
|
const scanDiscount = (_c = this.getDiscountList()) == null ? void 0 : _c.filter(
|
|
524
525
|
(item) => item.isScan
|
|
525
526
|
);
|
|
526
527
|
const scanDiscountIds = scanDiscount.map((n) => n.id);
|
|
527
|
-
const newGoodPassList = goodPassList
|
|
528
|
+
const newGoodPassList = goodPassList.filter((n) => !scanDiscountIds.includes(n.id));
|
|
528
529
|
const newDiscountList = [...scanDiscount, ...newGoodPassList || []];
|
|
529
530
|
this.store.originalDiscountList = newDiscountList;
|
|
530
531
|
await ((_d = this.store.discount) == null ? void 0 : _d.setOriginalDiscountList(newDiscountList));
|
|
@@ -3,6 +3,7 @@ import { BaseModule } from '../../modules/BaseModule';
|
|
|
3
3
|
import { VenueBookingAddLogParams, VenueBookingSlotConfig, VenueDateSummaryItem, VenueSlotSelection, VenueTimeSlotGrid } from './types';
|
|
4
4
|
import type { ScanOrderOrderProduct, ScanOrderOrderProductIdentity } from '../ScanOrder/types';
|
|
5
5
|
import type { UpdateProductInOrderParams } from '../../modules/Order/types';
|
|
6
|
+
import type { ScheduleItem } from '../../modules/Schedule/types';
|
|
6
7
|
import type { OpenDataAvailabilityResult } from '../../modules/OpenData';
|
|
7
8
|
import type { ProductData } from '../../modules/Product/types';
|
|
8
9
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
@@ -36,10 +37,17 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
36
37
|
private loginEffectDisposers;
|
|
37
38
|
private customerLoginRefreshInFlight;
|
|
38
39
|
private customerLoginRefreshIdInFlight;
|
|
40
|
+
/** 最近一次确认登录的客户;登录事件与 user 插件更新之间可能存在时序差。 */
|
|
41
|
+
private smartPricingCustomerId;
|
|
39
42
|
private loadAllProductsInFlight;
|
|
40
43
|
private productsLoaded;
|
|
41
44
|
private loadOpenDataConfigInFlight;
|
|
42
45
|
private static readonly OPEN_DATA_CACHE_TTL;
|
|
46
|
+
/** 按日期缓存 slot 智能定价 Map,避免同周重复 resolveProducts */
|
|
47
|
+
private slotPriceMapCache;
|
|
48
|
+
/** loadProducts 后缓存的全量商品(venue + addon),供分段算价复用 */
|
|
49
|
+
private smartPricingProductCatalog;
|
|
50
|
+
private static readonly PISELL1_LOGIN_SUCCESS;
|
|
43
51
|
private getLoggerContext;
|
|
44
52
|
private safeStringify;
|
|
45
53
|
private pickErrorMessage;
|
|
@@ -68,6 +76,22 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
68
76
|
passed: boolean | null;
|
|
69
77
|
failures: QuantityCheckResult[];
|
|
70
78
|
};
|
|
79
|
+
/** 清除 slot 价格分段缓存(商品重载 / 登录后 customerId 变化时调用) */
|
|
80
|
+
private clearSlotPriceMapCache;
|
|
81
|
+
/** 读取当前登录 customerId */
|
|
82
|
+
private resolveCustomerIdForSmartPricing;
|
|
83
|
+
private resolveAvailableWalletIdsForSmartPricing;
|
|
84
|
+
/** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
|
|
85
|
+
private getScheduleListForSmartPricing;
|
|
86
|
+
/** 构建智能定价上下文,对齐 OS Server buildProductFormatterContext */
|
|
87
|
+
private buildSmartPricingContext;
|
|
88
|
+
/** venue + addon 全量商品,供智能定价评估 */
|
|
89
|
+
private getAllProductsForSmartPricing;
|
|
90
|
+
private getSlotPriceMapCacheKey;
|
|
91
|
+
/**
|
|
92
|
+
* 按 schedule 分段构建 slot 价格 Map,带实例级缓存。
|
|
93
|
+
*/
|
|
94
|
+
private buildSlotPriceMapForDate;
|
|
71
95
|
loadAllProducts(): Promise<{
|
|
72
96
|
venueProducts: ProductData[];
|
|
73
97
|
addonProducts: ProductData[];
|
|
@@ -140,8 +164,7 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
140
164
|
setSlotConfig(config: Partial<VenueBookingSlotConfig>): void;
|
|
141
165
|
getSlotConfig(): VenueBookingSlotConfig;
|
|
142
166
|
loadSchedules(): Promise<void>;
|
|
143
|
-
|
|
144
|
-
getScheduleListByIds(ids: number[]): import("../../modules/Schedule/types").ScheduleItem[];
|
|
167
|
+
getScheduleListByIds(ids: number[]): ScheduleItem[];
|
|
145
168
|
getTempOrder(): import("./types").ScanOrderTempOrder | null;
|
|
146
169
|
updateTempOrderNote(note: string): string;
|
|
147
170
|
updateTempOrderContactsInfo(contactsInfo: any[]): any[];
|
|
@@ -149,7 +172,12 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
149
172
|
onCustomerLogin(params: {
|
|
150
173
|
customerId: number;
|
|
151
174
|
}): Promise<void>;
|
|
152
|
-
private
|
|
175
|
+
private recalculateOrderPricesFromSmartPricing;
|
|
176
|
+
/**
|
|
177
|
+
* DataVariant 重算价格后,同步刷新订单展示、Rules 与 Summary 共用的价格口径。
|
|
178
|
+
* Rules 会在本轮结束后根据当前客户的 discountList 重新写入实际折扣。
|
|
179
|
+
*/
|
|
180
|
+
private resetProductPriceForSmartPricing;
|
|
153
181
|
scanCode(code: string, customerId?: number): Promise<{
|
|
154
182
|
isAvailable: boolean;
|
|
155
183
|
discountList: import("../../modules/Discount").Discount[];
|
|
@@ -164,6 +192,15 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
|
|
|
164
192
|
discountId: number;
|
|
165
193
|
isSelected: boolean;
|
|
166
194
|
}): Promise<import("../../modules/Discount").Discount[]>;
|
|
195
|
+
/**
|
|
196
|
+
* 统一 VenueBooking 折扣后的订单行价。
|
|
197
|
+
*
|
|
198
|
+
* Rules 的 `discount_list.amount` 是已经按适用规则计算出的每件优惠额;它是这里唯一
|
|
199
|
+
* 的折扣金额来源。使用智能定价写入的 source_product_price 减去该金额,再同步
|
|
200
|
+
* selling_price 与 Summary 使用的 main_product_selling_price,避免 UI 的购物车行价、
|
|
201
|
+
* 小计和提交订单各自读取到不同的价格字段。
|
|
202
|
+
*/
|
|
203
|
+
private normalizeDiscountedOrderPrices;
|
|
167
204
|
addNewOrder(): Promise<import("./types").ScanOrderTempOrder>;
|
|
168
205
|
getOrderProducts(): ScanOrderOrderProduct[];
|
|
169
206
|
getSummary(): Promise<import("./types").ScanOrderSummary>;
|