@pisell/pisellos 2.3.161 → 2.3.163
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/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +1 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/Sales/index.js +1 -1
- package/dist/solution/ScanOrder/index.js +29 -3
- package/dist/solution/UnifiedBookingSales/index.d.ts +6 -0
- package/dist/solution/UnifiedBookingSales/index.js +867 -737
- package/lib/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +1 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/Sales/index.js +1 -1
- package/lib/solution/ScanOrder/index.js +28 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +6 -0
- package/lib/solution/UnifiedBookingSales/index.js +85 -1
- package/package.json +1 -1
|
@@ -595,7 +595,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
595
595
|
generateIdempotencyToken(): string;
|
|
596
596
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
597
597
|
createOrder(params: CommitOrderParams['query']): {
|
|
598
|
-
type: "
|
|
598
|
+
type: "virtual" | "appointment_booking";
|
|
599
599
|
platform: string;
|
|
600
600
|
sales_channel: string;
|
|
601
601
|
order_sales_channel: string;
|
|
@@ -213,6 +213,7 @@ export declare function normalizeBookingSubType(booking: Record<string, any>): s
|
|
|
213
213
|
export declare function normalizeSubmitBooking<T extends {
|
|
214
214
|
metadata?: Record<string, any>;
|
|
215
215
|
}>(booking: T): T;
|
|
216
|
+
export declare function resolveTableOccupancyDuration(tempOrder: OrderTempOrder): number;
|
|
216
217
|
/** 提交用人数:有限且为正则向下取整,否则为 1 */
|
|
217
218
|
export declare function normalizeSubmitCollectPaxValue(value: unknown): number;
|
|
218
219
|
/** 从临时订单 metadata 解析合成 booking 的 collect_pax */
|
|
@@ -1344,7 +1344,7 @@ export function normalizeSubmitBooking(booking) {
|
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
1346
|
var DEFAULT_TABLE_OCCUPANCY_DURATION = 20;
|
|
1347
|
-
function resolveTableOccupancyDuration(tempOrder) {
|
|
1347
|
+
export function resolveTableOccupancyDuration(tempOrder) {
|
|
1348
1348
|
var _metadata$table_confi, _metadata$tableConfig, _metadata$resource_co, _metadata$resourceCon;
|
|
1349
1349
|
var metadata = tempOrder.metadata || {};
|
|
1350
1350
|
var candidates = [metadata.table_occupancy_duration, metadata.booking_duration, metadata.table_duration, metadata.duration, (_metadata$table_confi = metadata.table_config) === null || _metadata$table_confi === void 0 ? void 0 : _metadata$table_confi.occupancy_duration, (_metadata$tableConfig = metadata.tableConfig) === null || _metadata$tableConfig === void 0 ? void 0 : _metadata$tableConfig.occupancy_duration, (_metadata$resource_co = metadata.resource_config) === null || _metadata$resource_co === void 0 ? void 0 : _metadata$resource_co.occupancy_duration, (_metadata$resourceCon = metadata.resourceConfig) === null || _metadata$resourceCon === void 0 ? void 0 : _metadata$resourceCon.occupancy_duration];
|
|
@@ -328,7 +328,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
328
328
|
date: string;
|
|
329
329
|
status: string;
|
|
330
330
|
week: string;
|
|
331
|
-
weekNum: 0 |
|
|
331
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -442,7 +442,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
442
442
|
} : {
|
|
443
443
|
external_sale_number: normalizedLookup
|
|
444
444
|
};
|
|
445
|
-
return _context6.abrupt("return", this.request.post('/local/print-order', _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
445
|
+
return _context6.abrupt("return", this.request.post('/shop/local/print-order', _objectSpread(_objectSpread({}, lookupPayload), {}, {
|
|
446
446
|
lookup_order_from_db: 1,
|
|
447
447
|
small_ticket_data_flag: 1,
|
|
448
448
|
business_code: businessCode,
|
|
@@ -36,7 +36,7 @@ import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleB
|
|
|
36
36
|
import { createModule } from "../BookingByStep/types";
|
|
37
37
|
import { ProductList } from "../../modules/ProductList";
|
|
38
38
|
import { getDateIsInSchedule } from "../../modules/Schedule/getDateIsInSchedule";
|
|
39
|
-
import { composeLinePrice, buildSubmitPayload, createUuidV4, getProductSkuOptions, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
39
|
+
import { composeLinePrice, buildSubmitPayload, createUuidV4, getProductSkuOptions, normalizeSubmitBooking, normalizeSubmitCollectPaxValue, resolveTableOccupancyDuration, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
40
|
import dayjs from 'dayjs';
|
|
41
41
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
42
42
|
export * from "./types";
|
|
@@ -1332,6 +1332,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
return prepareRetailAvailability;
|
|
1334
1334
|
}() // ScanOrder 提交 payload enhancer:
|
|
1335
|
+
// - 新单有桌台上下文但无 booking 时,补建基础预约(通用 Order 已不再自动生成)
|
|
1335
1336
|
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
1336
1337
|
// - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
|
|
1337
1338
|
// - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
|
|
@@ -1358,7 +1359,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1358
1359
|
return function (payload, _ref3) {
|
|
1359
1360
|
var _resourceState$relati, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati2, _pickFirstCustomCapac;
|
|
1360
1361
|
var bookingUuid = _ref3.bookingUuid,
|
|
1361
|
-
tempOrder = _ref3.tempOrder
|
|
1362
|
+
tempOrder = _ref3.tempOrder,
|
|
1363
|
+
now = _ref3.now;
|
|
1362
1364
|
var resourceId = String((_resourceState$relati = resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : '').trim();
|
|
1363
1365
|
var hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId && resourceState.relationId && resourceState.tableFormId);
|
|
1364
1366
|
if (!hasReservationBookingContext) {
|
|
@@ -1393,7 +1395,31 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1393
1395
|
} : undefined;
|
|
1394
1396
|
var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
|
|
1395
1397
|
var bookingCapacityDimensionId = (_pickFirstCustomCapac = pickFirstCustomCapacityDimensionId(_this5.enabledReservationRuleProducts)) !== null && _pickFirstCustomCapac !== void 0 ? _pickFirstCustomCapac : 0;
|
|
1396
|
-
var
|
|
1398
|
+
var bookings = payload.bookings || [];
|
|
1399
|
+
if (!tempOrder.order_id && bookings.length === 0) {
|
|
1400
|
+
var bookingStart = dayjs(now);
|
|
1401
|
+
var bookingDuration = resolveTableOccupancyDuration(tempOrder);
|
|
1402
|
+
var bookingEnd = bookingStart.add(bookingDuration, 'minute');
|
|
1403
|
+
bookings = [normalizeSubmitBooking({
|
|
1404
|
+
relation_id: 0,
|
|
1405
|
+
form_id: 0,
|
|
1406
|
+
start_time: bookingStart.format('HH:mm'),
|
|
1407
|
+
start_date: bookingStart.format('YYYY-MM-DD'),
|
|
1408
|
+
end_time: bookingEnd.format('HH:mm'),
|
|
1409
|
+
end_date: bookingEnd.format('YYYY-MM-DD'),
|
|
1410
|
+
duration: bookingDuration,
|
|
1411
|
+
metadata: {
|
|
1412
|
+
unique_identification_number: bookingUuid
|
|
1413
|
+
},
|
|
1414
|
+
select_date: bookingStart.format('YYYY-MM-DD'),
|
|
1415
|
+
is_all: false,
|
|
1416
|
+
like_status: 'common',
|
|
1417
|
+
schedule_id: 0,
|
|
1418
|
+
relation_type: '',
|
|
1419
|
+
number: 1
|
|
1420
|
+
})];
|
|
1421
|
+
}
|
|
1422
|
+
var nextBookings = bookings.map(function (booking, idx) {
|
|
1397
1423
|
var metadata = _objectSpread({}, booking.metadata || {});
|
|
1398
1424
|
if (hasExplicitCollectPax) {
|
|
1399
1425
|
metadata.collect_pax = normalizeSubmitCollectPaxValue(rawCollectPax);
|
|
@@ -105,6 +105,12 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
105
105
|
private normalizeAvailabilityIdList;
|
|
106
106
|
private normalizeAvailabilityStringList;
|
|
107
107
|
private normalizeAvailabilityPrepareDescriptor;
|
|
108
|
+
/**
|
|
109
|
+
* 列表直加没有经过 SKU availability flow,legacy cacheItem 的灵活时长可能落到
|
|
110
|
+
* 23:59。提交前用同一套营业排期补齐结束时间,保留已选开始时间、资源和 Holder。
|
|
111
|
+
* 仅供直加调用;手动时间选择和 availability candidate 不经过此方法。
|
|
112
|
+
*/
|
|
113
|
+
prepareDirectAddFlexibleBooking(cacheItem: any): Promise<any>;
|
|
108
114
|
private resolveAvailabilityPrepareDefaults;
|
|
109
115
|
private buildAvailabilityPrepareKey;
|
|
110
116
|
private clearAvailabilityRemoteResourceState;
|