@pisell/pisellos 0.10.8 → 0.10.9
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.js +0 -1
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
- package/dist/modules/BookingContext/utils/productExtend.js +5 -9
- package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
- package/dist/modules/Customer/index.d.ts +4 -0
- package/dist/modules/Customer/index.js +91 -59
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -0
- package/dist/modules/Discount/index.js +38 -5
- package/dist/modules/Discount/types.d.ts +11 -0
- package/dist/modules/Order/index.d.ts +20 -1
- package/dist/modules/Order/index.js +976 -730
- package/dist/modules/Order/types.d.ts +6 -1
- package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/dist/modules/Order/utils/virtualSettlement.js +271 -0
- package/dist/modules/Order/utils.js +89 -48
- package/dist/modules/Payment/types.d.ts +2 -0
- package/dist/modules/Payment/utils.js +4 -1
- package/dist/modules/Payment/walletpass.d.ts +11 -0
- package/dist/modules/Payment/walletpass.js +235 -60
- package/dist/modules/Product/types.d.ts +23 -0
- package/dist/modules/ProductList/index.d.ts +15 -2
- package/dist/modules/ProductList/index.js +92 -13
- package/dist/modules/SalesSummary/index.d.ts +1 -0
- package/dist/modules/SalesSummary/index.js +4 -3
- package/dist/modules/SalesSummary/types.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.d.ts +1 -0
- package/dist/modules/SalesSummary/utils.js +21 -1
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +90 -58
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +252 -94
- package/dist/server/utils/small-ticket.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +26 -2
- package/dist/solution/BaseSales/index.js +1310 -931
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +78 -12
- package/dist/solution/BookingByStep/index.d.ts +3 -3
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +221 -159
- package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/dist/solution/ScanOrder/index.js +25 -64
- package/lib/core/index.js +0 -1
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
- package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
- package/lib/modules/BookingContext/utils/productExtend.js +4 -3
- package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
- package/lib/modules/Customer/index.d.ts +4 -0
- package/lib/modules/Customer/index.js +11 -0
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -0
- package/lib/modules/Discount/index.js +37 -3
- package/lib/modules/Discount/types.d.ts +11 -0
- package/lib/modules/Order/index.d.ts +20 -1
- package/lib/modules/Order/index.js +393 -128
- package/lib/modules/Order/types.d.ts +6 -1
- package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
- package/lib/modules/Order/utils/virtualSettlement.js +300 -0
- package/lib/modules/Order/utils.js +65 -21
- package/lib/modules/Payment/types.d.ts +2 -0
- package/lib/modules/Payment/utils.js +5 -1
- package/lib/modules/Payment/walletpass.d.ts +11 -0
- package/lib/modules/Payment/walletpass.js +198 -17
- package/lib/modules/Product/types.d.ts +23 -0
- package/lib/modules/ProductList/index.d.ts +15 -2
- package/lib/modules/ProductList/index.js +85 -3
- package/lib/modules/SalesSummary/index.d.ts +1 -0
- package/lib/modules/SalesSummary/index.js +10 -2
- package/lib/modules/SalesSummary/types.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.d.ts +1 -0
- package/lib/modules/SalesSummary/utils.js +25 -1
- package/lib/server/index.d.ts +9 -0
- package/lib/server/index.js +54 -14
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +66 -2
- package/lib/server/utils/small-ticket.js +1 -1
- package/lib/solution/BaseSales/index.d.ts +26 -2
- package/lib/solution/BaseSales/index.js +261 -23
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +61 -11
- package/lib/solution/BookingByStep/index.d.ts +3 -3
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +30 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
- package/lib/solution/ScanOrder/index.js +17 -54
- package/package.json +1 -1
|
@@ -67,7 +67,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
67
67
|
product_ids?: number[];
|
|
68
68
|
collection?: number | string[];
|
|
69
69
|
schedule_date?: string;
|
|
70
|
-
}): Promise<
|
|
70
|
+
}): Promise<ProductData[]>;
|
|
71
71
|
/**
|
|
72
72
|
* 通过 schedule 来读取商品,适用于 session 类商品
|
|
73
73
|
*
|
|
@@ -87,7 +87,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
87
87
|
date: string;
|
|
88
88
|
product_ids?: number[];
|
|
89
89
|
category_ids?: number[];
|
|
90
|
-
}): Promise<
|
|
90
|
+
}): Promise<ProductData[]>;
|
|
91
91
|
/**
|
|
92
92
|
* 更新完商品数据、切换日期、或者在较后的流程里登录了,检测当前购物车里是否有商品,如果有,则需要更新购物车里的商品价格
|
|
93
93
|
*
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 2 | 1 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -64,6 +64,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
64
64
|
scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
|
|
65
65
|
private hydrateOrderCustomerFromScanDiscounts;
|
|
66
66
|
private getDiscountCustomerId;
|
|
67
|
+
resolveCustomerById(customerId: string | number): Promise<ICustomer | null>;
|
|
68
|
+
/** 兼容既有优惠码扫码逻辑。 */
|
|
67
69
|
private resolveCustomerByDiscountCustomerId;
|
|
68
70
|
private findCustomerById;
|
|
69
71
|
private normalizeCustomer;
|
|
@@ -126,7 +128,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
126
128
|
loadProducts(params?: ILoadProductsParams, options?: {
|
|
127
129
|
callback?: (result: any) => void;
|
|
128
130
|
subscriberId?: string;
|
|
129
|
-
}): Promise<
|
|
131
|
+
}): Promise<ProductData[]>;
|
|
130
132
|
/**
|
|
131
133
|
* 获取加时商品列表。
|
|
132
134
|
*
|
|
@@ -285,6 +287,8 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
285
287
|
private buildOrderCustomerPayload;
|
|
286
288
|
protected refreshDiscountConfigAfterOrderCustomerChange(customerId: number | null): Promise<void>;
|
|
287
289
|
protected waitForOrderCustomerPromotionRefresh(): Promise<void>;
|
|
290
|
+
protected prepareProductPriceQueryContext(customerId?: number | string): Promise<void>;
|
|
291
|
+
protected preferAuthoritativeProductQueryPrice(): boolean;
|
|
288
292
|
/**
|
|
289
293
|
* 获取客户分页信息
|
|
290
294
|
* @returns 分页信息
|
|
@@ -399,7 +399,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
399
399
|
}
|
|
400
400
|
return null;
|
|
401
401
|
}
|
|
402
|
-
async
|
|
402
|
+
async resolveCustomerById(customerId) {
|
|
403
403
|
var _a;
|
|
404
404
|
const localCustomers = this.store.customer.getCustomers();
|
|
405
405
|
const localCustomer = this.findCustomerById(localCustomers, customerId);
|
|
@@ -413,7 +413,23 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
413
413
|
num: 1
|
|
414
414
|
});
|
|
415
415
|
const remoteCustomer = this.findCustomerById((result == null ? void 0 : result.list) || [], customerId) || ((_a = result == null ? void 0 : result.list) == null ? void 0 : _a[0]) || null;
|
|
416
|
-
|
|
416
|
+
if (remoteCustomer) {
|
|
417
|
+
return this.normalizeCustomer(remoteCustomer);
|
|
418
|
+
}
|
|
419
|
+
try {
|
|
420
|
+
const detailCustomer = await this.store.customer.queryCustomerDetail(customerId);
|
|
421
|
+
return detailCustomer ? this.normalizeCustomer(detailCustomer) : null;
|
|
422
|
+
} catch (error) {
|
|
423
|
+
console.warn(
|
|
424
|
+
"[BookingTicket] resolveCustomerById detail request failed",
|
|
425
|
+
{ customerId, error }
|
|
426
|
+
);
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
/** 兼容既有优惠码扫码逻辑。 */
|
|
431
|
+
resolveCustomerByDiscountCustomerId(customerId) {
|
|
432
|
+
return this.resolveCustomerById(customerId);
|
|
417
433
|
}
|
|
418
434
|
findCustomerById(customers = [], customerId) {
|
|
419
435
|
return customers.find((customer) => {
|
|
@@ -1020,6 +1036,18 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1020
1036
|
waitForOrderCustomerPromotionRefresh() {
|
|
1021
1037
|
return this.orderCustomerPromotionRefreshInFlight || Promise.resolve();
|
|
1022
1038
|
}
|
|
1039
|
+
async prepareProductPriceQueryContext(customerId) {
|
|
1040
|
+
await Promise.resolve();
|
|
1041
|
+
const normalizedCustomerId = Number(customerId || 0);
|
|
1042
|
+
const refreshTask = this.orderCustomerDiscountRefreshInFlight;
|
|
1043
|
+
const shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
|
|
1044
|
+
if (shouldWait && refreshTask) {
|
|
1045
|
+
await refreshTask;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
preferAuthoritativeProductQueryPrice() {
|
|
1049
|
+
return true;
|
|
1050
|
+
}
|
|
1023
1051
|
/**
|
|
1024
1052
|
* 获取客户分页信息
|
|
1025
1053
|
* @returns 分页信息
|
|
@@ -277,7 +277,7 @@ function transformDetailToProductAndBooking(cacheItem, ctx) {
|
|
|
277
277
|
return { product: productInput, booking, cacheItem: preparedCacheItem };
|
|
278
278
|
}
|
|
279
279
|
function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
280
|
-
var _a, _b, _c, _d;
|
|
280
|
+
var _a, _b, _c, _d, _e, _f;
|
|
281
281
|
const other = ((_a = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _a.other) || {};
|
|
282
282
|
const quantity = (ctx == null ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : ((_b = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _b.quantity) ?? 1;
|
|
283
283
|
const resolvedPid = (cacheItem == null ? void 0 : cacheItem.product_id) ?? (cacheItem == null ? void 0 : cacheItem.id);
|
|
@@ -304,6 +304,7 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
|
304
304
|
bundle_edit: extend == null ? void 0 : extend.bundle_edit,
|
|
305
305
|
discount_reason: extend == null ? void 0 : extend.discount_reason,
|
|
306
306
|
discount_list: cacheItem == null ? void 0 : cacheItem.discount_list,
|
|
307
|
+
selected_settlement_snapshot: ((_e = cacheItem == null ? void 0 : cacheItem.metadata) == null ? void 0 : _e.selected_settlement_snapshot) ?? ((_f = extend == null ? void 0 : extend.metadata) == null ? void 0 : _f.selected_settlement_snapshot),
|
|
307
308
|
_extend: extend
|
|
308
309
|
};
|
|
309
310
|
}
|
|
@@ -1708,60 +1708,23 @@ var _ScanOrderImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1708
1708
|
schedule_datetime: scheduleDatetime,
|
|
1709
1709
|
cacheId: this.cacheId
|
|
1710
1710
|
});
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
pendingRequestPaxMax = paxBounds.max;
|
|
1729
|
-
}
|
|
1730
|
-
} else {
|
|
1731
|
-
this.enabledReservationRuleProducts = [];
|
|
1732
|
-
const error = loaded instanceof Error ? loaded : new Error("预约规则商品列表接口返回异常");
|
|
1733
|
-
this.logMethodError("loadReservationRuleProducts", error, {
|
|
1734
|
-
resourceId: normalizedResourceId,
|
|
1735
|
-
reservationLinkIds,
|
|
1736
|
-
scheduleDate,
|
|
1737
|
-
scheduleDatetime,
|
|
1738
|
-
cacheId: this.cacheId
|
|
1739
|
-
});
|
|
1740
|
-
if (Array.isArray(loaded)) {
|
|
1741
|
-
this.enabledReservationRuleProducts = loaded;
|
|
1742
|
-
const occupancyMinutes = (0, import_utils.pickFirstDurationMinutesFromProducts)(loaded);
|
|
1743
|
-
if (occupancyMinutes !== void 0) {
|
|
1744
|
-
tempOrder.metadata.table_occupancy_duration = occupancyMinutes;
|
|
1745
|
-
}
|
|
1746
|
-
if ((0, import_utils.hasCustomCapacityProduct)(loaded)) {
|
|
1747
|
-
pendingRequestEntryPax = 1;
|
|
1748
|
-
const paxBounds = (0, import_utils.pickFirstCustomCapacityPaxBounds)(loaded);
|
|
1749
|
-
if ((paxBounds == null ? void 0 : paxBounds.min) !== void 0)
|
|
1750
|
-
pendingRequestPaxMin = paxBounds.min;
|
|
1751
|
-
if ((paxBounds == null ? void 0 : paxBounds.max) !== void 0)
|
|
1752
|
-
pendingRequestPaxMax = paxBounds.max;
|
|
1753
|
-
}
|
|
1754
|
-
} else {
|
|
1755
|
-
this.enabledReservationRuleProducts = [];
|
|
1756
|
-
const error2 = loaded instanceof Error ? loaded : new Error("预约规则商品列表接口返回异常");
|
|
1757
|
-
this.logMethodError("loadReservationRuleProducts", error2, {
|
|
1758
|
-
resourceId,
|
|
1759
|
-
reservationLinkIds,
|
|
1760
|
-
scheduleDate,
|
|
1761
|
-
scheduleDatetime,
|
|
1762
|
-
cacheId: this.cacheId
|
|
1763
|
-
});
|
|
1764
|
-
}
|
|
1711
|
+
const matchedRuleProduct = (0, import_utils.findReservationRuleProductByResourceId)(
|
|
1712
|
+
loaded,
|
|
1713
|
+
normalizedResourceId
|
|
1714
|
+
);
|
|
1715
|
+
const ruleProductsForResource = matchedRuleProduct ? [matchedRuleProduct] : [];
|
|
1716
|
+
this.enabledReservationRuleProducts = ruleProductsForResource;
|
|
1717
|
+
const occupancyMinutes = (0, import_utils.pickFirstDurationMinutesFromProducts)(ruleProductsForResource);
|
|
1718
|
+
if (occupancyMinutes !== void 0) {
|
|
1719
|
+
tempOrder.metadata.table_occupancy_duration = occupancyMinutes;
|
|
1720
|
+
}
|
|
1721
|
+
if ((0, import_utils.hasCustomCapacityProduct)(ruleProductsForResource)) {
|
|
1722
|
+
pendingRequestEntryPax = 1;
|
|
1723
|
+
const paxBounds = (0, import_utils.pickFirstCustomCapacityPaxBounds)(ruleProductsForResource);
|
|
1724
|
+
if ((paxBounds == null ? void 0 : paxBounds.min) !== void 0)
|
|
1725
|
+
pendingRequestPaxMin = paxBounds.min;
|
|
1726
|
+
if ((paxBounds == null ? void 0 : paxBounds.max) !== void 0)
|
|
1727
|
+
pendingRequestPaxMax = paxBounds.max;
|
|
1765
1728
|
}
|
|
1766
1729
|
const occupyDetails = await this.fetchResourceOccupyDetailsByResourceId(normalizedResourceId);
|
|
1767
1730
|
const occupyDetail = occupyDetails[0] ?? null;
|