@pisell/pisellos 2.3.162 → 2.3.164
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/modules/Order/utils.d.ts +1 -0
- package/dist/modules/Order/utils.js +1 -1
- package/dist/shared/receipt/small-ticket.js +7 -6
- package/dist/shared/receipt/templateVisibility.d.ts +3 -0
- package/dist/shared/receipt/templateVisibility.js +6 -2
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/ScanOrder/index.js +29 -3
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Order/utils.d.ts +1 -0
- package/lib/modules/Order/utils.js +1 -0
- package/lib/shared/receipt/small-ticket.js +7 -6
- package/lib/shared/receipt/templateVisibility.d.ts +3 -0
- package/lib/shared/receipt/templateVisibility.js +6 -2
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/ScanOrder/index.js +28 -2
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -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];
|
|
@@ -357,7 +357,7 @@ function buildLocaleData(params) {
|
|
|
357
357
|
financials: financials
|
|
358
358
|
}),
|
|
359
359
|
customer: buildCustomer(order, locale, visibility.customer),
|
|
360
|
-
appointment: buildAppointment(order, locale)
|
|
360
|
+
appointment: buildAppointment(order, locale, visibility.lineGroups.resourceTitle)
|
|
361
361
|
}, delivery.length ? {
|
|
362
362
|
delivery: delivery
|
|
363
363
|
} : {}), {}, {
|
|
@@ -1383,7 +1383,7 @@ function formatPickupBookingStart(bookings, locale) {
|
|
|
1383
1383
|
var dateText = locale === 'en' ? "".concat(day, "/").concat(month, "/").concat(year) : "".concat(year, "/").concat(month, "/").concat(day);
|
|
1384
1384
|
return "".concat(time.slice(0, 5), " ").concat(dateText);
|
|
1385
1385
|
}
|
|
1386
|
-
function buildAppointment(order, locale) {
|
|
1386
|
+
function buildAppointment(order, locale, showResourceTitle) {
|
|
1387
1387
|
var _order$metadata13, _order$metadata14, _order$metadata15, _order$form_data;
|
|
1388
1388
|
var parentScheduleId = (_order$metadata13 = order.metadata) === null || _order$metadata13 === void 0 ? void 0 : _order$metadata13.appointment_booking_parent_schedule_id;
|
|
1389
1389
|
var bookings = sortBookings(normalizeArray(order.bookings).filter(function (booking) {
|
|
@@ -1396,7 +1396,8 @@ function buildAppointment(order, locale) {
|
|
|
1396
1396
|
booking: booking,
|
|
1397
1397
|
allResources: allResources,
|
|
1398
1398
|
bookingCount: bookings.length,
|
|
1399
|
-
locale: locale
|
|
1399
|
+
locale: locale,
|
|
1400
|
+
showResourceTitle: showResourceTitle
|
|
1400
1401
|
});
|
|
1401
1402
|
});
|
|
1402
1403
|
}
|
|
@@ -1434,7 +1435,7 @@ function buildAppointmentRows(params) {
|
|
|
1434
1435
|
};
|
|
1435
1436
|
var bookingId = stringify(firstPresentValue(booking.booking_id, booking.schedule_event_id, bookingUid)).trim();
|
|
1436
1437
|
var bookingTime = formatBookingRange(booking, locale);
|
|
1437
|
-
var resourceText = formatBookingResources(resolveBookingResourcesForReceipt(booking, allResources, bookingCount), locale);
|
|
1438
|
+
var resourceText = formatBookingResources(resolveBookingResourcesForReceipt(booking, allResources, bookingCount), locale, params.showResourceTitle);
|
|
1438
1439
|
var holder = getLocalizedValue((_booking$holder$name = (_booking$holder = booking.holder) === null || _booking$holder === void 0 ? void 0 : _booking$holder.name) !== null && _booking$holder$name !== void 0 ? _booking$holder$name : (_booking$metadata3 = booking.metadata) === null || _booking$metadata3 === void 0 || (_booking$metadata3 = _booking$metadata3.holder) === null || _booking$metadata3 === void 0 ? void 0 : _booking$metadata3.name, locale).trim();
|
|
1439
1440
|
return [_objectSpread(_objectSpread({}, receiptKey(booking, 'booking-id')), {}, {
|
|
1440
1441
|
item: label(locale, 'bookingId'),
|
|
@@ -1512,10 +1513,10 @@ function resolveBookingResourcesForReceipt(booking, allResources, bookingCount)
|
|
|
1512
1513
|
if (bookingCount === 1 && allResources.length) return allResources;
|
|
1513
1514
|
return [];
|
|
1514
1515
|
}
|
|
1515
|
-
function formatBookingResources(resources, locale) {
|
|
1516
|
+
function formatBookingResources(resources, locale, showResourceTitle) {
|
|
1516
1517
|
return resources.map(function (resource) {
|
|
1517
1518
|
var _resource$metadata, _resource$metadata2, _resource$metadata3, _resource$metadata4;
|
|
1518
|
-
return [getLocalizedValue(resource.form_title || ((_resource$metadata = resource.metadata) === null || _resource$metadata === void 0 ? void 0 : _resource$metadata.form_name) || resource.relation_form_name || ((_resource$metadata2 = resource.metadata) === null || _resource$metadata2 === void 0 ? void 0 : _resource$metadata2.relation_form_name), locale), getLocalizedValue(resource.title || resource.name || resource.main_field || ((_resource$metadata3 = resource.metadata) === null || _resource$metadata3 === void 0 ? void 0 : _resource$metadata3.main_field) || ((_resource$metadata4 = resource.metadata) === null || _resource$metadata4 === void 0 ? void 0 : _resource$metadata4.resource_name), locale)].filter(Boolean).join(' ');
|
|
1519
|
+
return [showResourceTitle ? getLocalizedValue(resource.form_title || ((_resource$metadata = resource.metadata) === null || _resource$metadata === void 0 ? void 0 : _resource$metadata.form_name) || resource.relation_form_name || ((_resource$metadata2 = resource.metadata) === null || _resource$metadata2 === void 0 ? void 0 : _resource$metadata2.relation_form_name), locale) : '', getLocalizedValue(resource.title || resource.name || resource.main_field || ((_resource$metadata3 = resource.metadata) === null || _resource$metadata3 === void 0 ? void 0 : _resource$metadata3.main_field) || ((_resource$metadata4 = resource.metadata) === null || _resource$metadata4 === void 0 ? void 0 : _resource$metadata4.resource_name), locale)].filter(Boolean).join(' ');
|
|
1519
1520
|
}).filter(Boolean).join(', ');
|
|
1520
1521
|
}
|
|
1521
1522
|
function sortBookings(bookings) {
|
|
@@ -36,6 +36,9 @@ export function resolveInvoiceDataVisibility(settings) {
|
|
|
36
36
|
return typeof tag === 'string' && tag.length > 0;
|
|
37
37
|
})) : null;
|
|
38
38
|
return {
|
|
39
|
+
lineGroups: {
|
|
40
|
+
resourceTitle: field(module('line_groups'), 'resource_title')
|
|
41
|
+
},
|
|
39
42
|
handover: {
|
|
40
43
|
show: invoiceSettingIsVisible(handover === null || handover === void 0 ? void 0 : handover.is_show),
|
|
41
44
|
method: field(handover, 'method'),
|
|
@@ -59,6 +62,7 @@ export function requiresInvoiceDataFiltering(settings) {
|
|
|
59
62
|
var _resolveInvoiceDataVi = resolveInvoiceDataVisibility(settings),
|
|
60
63
|
handover = _resolveInvoiceDataVi.handover,
|
|
61
64
|
customer = _resolveInvoiceDataVi.customer,
|
|
62
|
-
card = _resolveInvoiceDataVi.card
|
|
63
|
-
|
|
65
|
+
card = _resolveInvoiceDataVi.card,
|
|
66
|
+
lineGroups = _resolveInvoiceDataVi.lineGroups;
|
|
67
|
+
return !lineGroups.resourceTitle || !handover.show || !handover.method || !handover.fulfillmentTime || !customer.show || !customer.name || !customer.email || !customer.phone || !card.show || card.passTypes !== null;
|
|
64
68
|
}
|
|
@@ -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 | 6 | 4 | 5 | 3;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -347,7 +347,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
347
347
|
count: number;
|
|
348
348
|
left: number;
|
|
349
349
|
summaryCount: number;
|
|
350
|
-
status: "
|
|
350
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
351
351
|
}[];
|
|
352
352
|
/**
|
|
353
353
|
* 找到多个资源的公共可用时间段
|
|
@@ -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);
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _adapter.PromotionAdapter;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _evaluator.PromotionEvaluator;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "default", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _adapter.default;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var _evaluator = require("./evaluator");
|
|
43
|
-
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
-
var _examples = require("./examples");
|
|
45
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
1
|
+
"use strict";
|
|
@@ -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 */
|
|
@@ -109,6 +109,7 @@ Object.defineProperty(exports, "resolveSafeProductNum", {
|
|
|
109
109
|
});
|
|
110
110
|
exports.resolveSubmitCollectPax = resolveSubmitCollectPax;
|
|
111
111
|
exports.resolveSubmitOrderType = resolveSubmitOrderType;
|
|
112
|
+
exports.resolveTableOccupancyDuration = resolveTableOccupancyDuration;
|
|
112
113
|
Object.defineProperty(exports, "shouldBuildManualProductDiscount", {
|
|
113
114
|
enumerable: true,
|
|
114
115
|
get: function () {
|
|
@@ -341,7 +341,7 @@ function buildLocaleData(params) {
|
|
|
341
341
|
financials
|
|
342
342
|
}),
|
|
343
343
|
customer: buildCustomer(order, locale, visibility.customer),
|
|
344
|
-
appointment: buildAppointment(order, locale),
|
|
344
|
+
appointment: buildAppointment(order, locale, visibility.lineGroups.resourceTitle),
|
|
345
345
|
...(delivery.length ? {
|
|
346
346
|
delivery
|
|
347
347
|
} : {}),
|
|
@@ -1322,7 +1322,7 @@ function formatPickupBookingStart(bookings, locale) {
|
|
|
1322
1322
|
const dateText = locale === 'en' ? `${day}/${month}/${year}` : `${year}/${month}/${day}`;
|
|
1323
1323
|
return `${time.slice(0, 5)} ${dateText}`;
|
|
1324
1324
|
}
|
|
1325
|
-
function buildAppointment(order, locale) {
|
|
1325
|
+
function buildAppointment(order, locale, showResourceTitle) {
|
|
1326
1326
|
const parentScheduleId = order.metadata?.appointment_booking_parent_schedule_id;
|
|
1327
1327
|
const bookings = sortBookings(normalizeArray(order.bookings).filter(booking => !(0, _pickupTiming.isFulfillmentTimingBooking)(booking) && isReceiptAppointmentBooking(booking, parentScheduleId)));
|
|
1328
1328
|
if (bookings.length) {
|
|
@@ -1331,7 +1331,8 @@ function buildAppointment(order, locale) {
|
|
|
1331
1331
|
booking,
|
|
1332
1332
|
allResources,
|
|
1333
1333
|
bookingCount: bookings.length,
|
|
1334
|
-
locale
|
|
1334
|
+
locale,
|
|
1335
|
+
showResourceTitle
|
|
1335
1336
|
}));
|
|
1336
1337
|
}
|
|
1337
1338
|
const tableName = order.table_name || order.metadata?.table_name || order.metadata?.table?.name || order.form_data?.table_name;
|
|
@@ -1370,7 +1371,7 @@ function buildAppointmentRows(params) {
|
|
|
1370
1371
|
};
|
|
1371
1372
|
const bookingId = stringify(firstPresentValue(booking.booking_id, booking.schedule_event_id, bookingUid)).trim();
|
|
1372
1373
|
const bookingTime = formatBookingRange(booking, locale);
|
|
1373
|
-
const resourceText = formatBookingResources(resolveBookingResourcesForReceipt(booking, allResources, bookingCount), locale);
|
|
1374
|
+
const resourceText = formatBookingResources(resolveBookingResourcesForReceipt(booking, allResources, bookingCount), locale, params.showResourceTitle);
|
|
1374
1375
|
const holder = getLocalizedValue(booking.holder?.name ?? booking.metadata?.holder?.name, locale).trim();
|
|
1375
1376
|
return [{
|
|
1376
1377
|
...receiptKey(booking, 'booking-id'),
|
|
@@ -1432,8 +1433,8 @@ function resolveBookingResourcesForReceipt(booking, allResources, bookingCount)
|
|
|
1432
1433
|
if (bookingCount === 1 && allResources.length) return allResources;
|
|
1433
1434
|
return [];
|
|
1434
1435
|
}
|
|
1435
|
-
function formatBookingResources(resources, locale) {
|
|
1436
|
-
return resources.map(resource => [getLocalizedValue(resource.form_title || resource.metadata?.form_name || resource.relation_form_name || resource.metadata?.relation_form_name, locale), getLocalizedValue(resource.title || resource.name || resource.main_field || resource.metadata?.main_field || resource.metadata?.resource_name, locale)].filter(Boolean).join(' ')).filter(Boolean).join(', ');
|
|
1436
|
+
function formatBookingResources(resources, locale, showResourceTitle) {
|
|
1437
|
+
return resources.map(resource => [showResourceTitle ? getLocalizedValue(resource.form_title || resource.metadata?.form_name || resource.relation_form_name || resource.metadata?.relation_form_name, locale) : '', getLocalizedValue(resource.title || resource.name || resource.main_field || resource.metadata?.main_field || resource.metadata?.resource_name, locale)].filter(Boolean).join(' ')).filter(Boolean).join(', ');
|
|
1437
1438
|
}
|
|
1438
1439
|
function sortBookings(bookings) {
|
|
1439
1440
|
return bookings.map((booking, index) => ({
|
|
@@ -34,6 +34,9 @@ function resolveInvoiceDataVisibility(settings) {
|
|
|
34
34
|
const field = (config, key) => invoiceSettingIsVisible(config?.[key]?.is_show);
|
|
35
35
|
const passTypes = Array.isArray(card?.pass_type) && card.pass_type.length > 0 ? new Set(card.pass_type.filter(tag => typeof tag === 'string' && tag.length > 0)) : null;
|
|
36
36
|
return {
|
|
37
|
+
lineGroups: {
|
|
38
|
+
resourceTitle: field(module('line_groups'), 'resource_title')
|
|
39
|
+
},
|
|
37
40
|
handover: {
|
|
38
41
|
show: invoiceSettingIsVisible(handover?.is_show),
|
|
39
42
|
method: field(handover, 'method'),
|
|
@@ -57,7 +60,8 @@ function requiresInvoiceDataFiltering(settings) {
|
|
|
57
60
|
const {
|
|
58
61
|
handover,
|
|
59
62
|
customer,
|
|
60
|
-
card
|
|
63
|
+
card,
|
|
64
|
+
lineGroups
|
|
61
65
|
} = resolveInvoiceDataVisibility(settings);
|
|
62
|
-
return !handover.show || !handover.method || !handover.fulfillmentTime || !customer.show || !customer.name || !customer.email || !customer.phone || !card.show || card.passTypes !== null;
|
|
66
|
+
return !lineGroups.resourceTitle || !handover.show || !handover.method || !handover.fulfillmentTime || !customer.show || !customer.name || !customer.email || !customer.phone || !card.show || card.passTypes !== null;
|
|
63
67
|
}
|
|
@@ -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 | 6 | 4 | 5 | 3;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -347,7 +347,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
347
347
|
count: number;
|
|
348
348
|
left: number;
|
|
349
349
|
summaryCount: number;
|
|
350
|
-
status: "
|
|
350
|
+
status: "lots_of_space" | "filling_up_fast" | "sold_out";
|
|
351
351
|
}[];
|
|
352
352
|
/**
|
|
353
353
|
* 找到多个资源的公共可用时间段
|
|
@@ -797,6 +797,7 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
797
797
|
}
|
|
798
798
|
|
|
799
799
|
// ScanOrder 提交 payload enhancer:
|
|
800
|
+
// - 新单有桌台上下文但无 booking 时,补建基础预约(通用 Order 已不再自动生成)
|
|
800
801
|
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
801
802
|
// - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
|
|
802
803
|
// - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
|
|
@@ -818,7 +819,8 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
818
819
|
};
|
|
819
820
|
return (payload, {
|
|
820
821
|
bookingUuid,
|
|
821
|
-
tempOrder
|
|
822
|
+
tempOrder,
|
|
823
|
+
now
|
|
822
824
|
}) => {
|
|
823
825
|
const resourceId = String(resourceState?.relationId ?? '').trim();
|
|
824
826
|
const hasReservationBookingContext = Boolean(ruleProduct && resourceState && resourceId && resourceState.relationId && resourceState.tableFormId);
|
|
@@ -855,7 +857,31 @@ class ScanOrderImpl extends _BaseSales.BaseSalesImpl {
|
|
|
855
857
|
} : undefined;
|
|
856
858
|
const ruleProductUid = ruleProduct ? (0, _utils2.createUuidV4)() : undefined;
|
|
857
859
|
const bookingCapacityDimensionId = (0, _utils.pickFirstCustomCapacityDimensionId)(this.enabledReservationRuleProducts) ?? 0;
|
|
858
|
-
|
|
860
|
+
let bookings = payload.bookings || [];
|
|
861
|
+
if (!tempOrder.order_id && bookings.length === 0) {
|
|
862
|
+
const bookingStart = (0, _dayjs.default)(now);
|
|
863
|
+
const bookingDuration = (0, _utils2.resolveTableOccupancyDuration)(tempOrder);
|
|
864
|
+
const bookingEnd = bookingStart.add(bookingDuration, 'minute');
|
|
865
|
+
bookings = [(0, _utils2.normalizeSubmitBooking)({
|
|
866
|
+
relation_id: 0,
|
|
867
|
+
form_id: 0,
|
|
868
|
+
start_time: bookingStart.format('HH:mm'),
|
|
869
|
+
start_date: bookingStart.format('YYYY-MM-DD'),
|
|
870
|
+
end_time: bookingEnd.format('HH:mm'),
|
|
871
|
+
end_date: bookingEnd.format('YYYY-MM-DD'),
|
|
872
|
+
duration: bookingDuration,
|
|
873
|
+
metadata: {
|
|
874
|
+
unique_identification_number: bookingUuid
|
|
875
|
+
},
|
|
876
|
+
select_date: bookingStart.format('YYYY-MM-DD'),
|
|
877
|
+
is_all: false,
|
|
878
|
+
like_status: 'common',
|
|
879
|
+
schedule_id: 0,
|
|
880
|
+
relation_type: '',
|
|
881
|
+
number: 1
|
|
882
|
+
})];
|
|
883
|
+
}
|
|
884
|
+
const nextBookings = bookings.map((booking, idx) => {
|
|
859
885
|
const metadata = {
|
|
860
886
|
...(booking.metadata || {})
|
|
861
887
|
};
|