@pisell/pisellos 2.2.98 → 2.2.99
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/server/index.d.ts +30 -0
- package/dist/server/index.js +660 -330
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +3 -0
- package/dist/server/modules/index.js +4 -0
- package/dist/server/modules/order/types.d.ts +13 -1
- package/dist/server/modules/order/types.js +2 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +64 -4
- package/dist/server/types.d.ts +2 -0
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Sales/index.d.ts +2 -1
- package/dist/solution/Sales/index.js +23 -10
- package/dist/solution/Sales/types.d.ts +1 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/server/index.d.ts +30 -0
- package/lib/server/index.js +202 -9
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +327 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +34 -0
- package/lib/server/modules/index.d.ts +3 -0
- package/lib/server/modules/index.js +6 -0
- package/lib/server/modules/order/types.d.ts +13 -1
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +69 -3
- package/lib/server/types.d.ts +2 -0
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Sales/index.d.ts +2 -1
- package/lib/solution/Sales/index.js +11 -4
- package/lib/solution/Sales/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 平面图(floor-plan)Server 模块类型
|
|
3
|
+
* 与 GET /shop/schedule/floor-plan 系列接口数据结构对齐
|
|
4
|
+
*/
|
|
5
|
+
export interface FloorPlanItem {
|
|
6
|
+
id: number;
|
|
7
|
+
shop_id?: number;
|
|
8
|
+
code: string;
|
|
9
|
+
name: string | Record<string, string>;
|
|
10
|
+
layout: unknown[];
|
|
11
|
+
canvas_width: number;
|
|
12
|
+
canvas_height: number;
|
|
13
|
+
sort: number;
|
|
14
|
+
status: number;
|
|
15
|
+
created_at?: string;
|
|
16
|
+
updated_at?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FloorPlanState {
|
|
19
|
+
list: FloorPlanItem[];
|
|
20
|
+
map: Map<string, FloorPlanItem>;
|
|
21
|
+
codeMap: Map<string, FloorPlanItem>;
|
|
22
|
+
}
|
|
23
|
+
/** pubsub / Ably 推送消息(与《平面图编辑器API文档》Socket 一节一致) */
|
|
24
|
+
export interface FloorPlanSyncMessage {
|
|
25
|
+
module?: string;
|
|
26
|
+
action?: string;
|
|
27
|
+
operation?: string;
|
|
28
|
+
id?: number;
|
|
29
|
+
ids?: number[];
|
|
30
|
+
body?: Partial<FloorPlanItem> & {
|
|
31
|
+
id?: number;
|
|
32
|
+
};
|
|
33
|
+
message_uuid?: string;
|
|
34
|
+
timestamp?: string;
|
|
35
|
+
_channelKey?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const FloorPlanHooks: {
|
|
38
|
+
/** 本地列表变更(预加载、合并、删除后) */
|
|
39
|
+
readonly onFloorPlansChanged: "server_floor_plan:onFloorPlansChanged";
|
|
40
|
+
/** pubsub 同步处理完成,供 Server 向订阅者推送最新查询结果 */
|
|
41
|
+
readonly onFloorPlanSyncCompleted: "server_floor_plan:onFloorPlanSyncCompleted";
|
|
42
|
+
};
|
|
43
|
+
export type FloorPlanHooksType = (typeof FloorPlanHooks)[keyof typeof FloorPlanHooks];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 平面图(floor-plan)Server 模块类型
|
|
3
|
+
* 与 GET /shop/schedule/floor-plan 系列接口数据结构对齐
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** pubsub / Ably 推送消息(与《平面图编辑器API文档》Socket 一节一致) */
|
|
7
|
+
|
|
8
|
+
export var FloorPlanHooks = {
|
|
9
|
+
/** 本地列表变更(预加载、合并、删除后) */
|
|
10
|
+
onFloorPlansChanged: 'server_floor_plan:onFloorPlansChanged',
|
|
11
|
+
/** pubsub 同步处理完成,供 Server 向订阅者推送最新查询结果 */
|
|
12
|
+
onFloorPlanSyncCompleted: 'server_floor_plan:onFloorPlanSyncCompleted'
|
|
13
|
+
};
|
|
@@ -16,6 +16,9 @@ export type { ScheduleState, ScheduleItem } from './schedule/types';
|
|
|
16
16
|
export { OrderModule } from './order';
|
|
17
17
|
export type { OrderState, OrderData, OrderId, OrderSummary, OrderBookingItem, OrderProductLineItem, OrderPaymentItem, OrderSurchargeItem, OrderProductDiscountItem, OrderWithoutBookings, BookingData, OrderFilters, BookingFilters, OrderFilterResult, BookingFilterResult, OrderModulePagedResult, } from './order/types';
|
|
18
18
|
export { OrderHooks } from './order/types';
|
|
19
|
+
export { FloorPlanModule } from './floor-plan';
|
|
20
|
+
export type { FloorPlanItem, FloorPlanState, FloorPlanSyncMessage } from './floor-plan/types';
|
|
21
|
+
export { FloorPlanHooks } from './floor-plan/types';
|
|
19
22
|
export { ResourceModule, resourceModule } from './resource';
|
|
20
23
|
export type { ResourceState, ResourceData, ResourceId, ResourceBooking, ResourcePageQuery, ResourcePageResult, QueryOptions, ScheduleEventResource, } from './resource';
|
|
21
24
|
export { ResourceHooks } from './resource';
|
|
@@ -21,6 +21,10 @@ export { ScheduleModuleEx } from "./schedule";
|
|
|
21
21
|
export { OrderModule } from "./order";
|
|
22
22
|
export { OrderHooks } from "./order/types";
|
|
23
23
|
|
|
24
|
+
// 平面图(floor-plan)
|
|
25
|
+
export { FloorPlanModule } from "./floor-plan";
|
|
26
|
+
export { FloorPlanHooks } from "./floor-plan/types";
|
|
27
|
+
|
|
24
28
|
// Resource 模块
|
|
25
29
|
export { ResourceModule, resourceModule } from "./resource";
|
|
26
30
|
export { ResourceHooks } from "./resource";
|
|
@@ -121,6 +121,8 @@ export interface OrderProductLineItem {
|
|
|
121
121
|
product_bundle?: OrderProductBundleItem[];
|
|
122
122
|
/** 元数据;含 unique_identification_number。来源:Detail.metadata */
|
|
123
123
|
metadata?: OrderProductMetadata | null;
|
|
124
|
+
/** 关联子预约 ID(仅输出,预约订单场景)。来源:Detail.schedule_event_id */
|
|
125
|
+
schedule_event_id?: number | null;
|
|
124
126
|
}
|
|
125
127
|
/** 预约条目 metadata,常含 unique_identification_number */
|
|
126
128
|
export interface OrderBookingMetadata {
|
|
@@ -188,6 +190,14 @@ export interface OrderBookingItem {
|
|
|
188
190
|
holder?: Record<string, unknown> | null;
|
|
189
191
|
/** 元数据;含 unique_identification_number。来源:ScheduleEvent.metadata */
|
|
190
192
|
metadata?: OrderBookingMetadata | null;
|
|
193
|
+
/**
|
|
194
|
+
* 与订单明细等资源的关联(如 resource_type 为订单 Detail 时 resource_id 对应 order_detail_id)。
|
|
195
|
+
* 来源:服务端 ScheduleEvent 关联表。
|
|
196
|
+
*/
|
|
197
|
+
relation_items?: {
|
|
198
|
+
resource_id?: number | null;
|
|
199
|
+
[key: string]: unknown;
|
|
200
|
+
}[];
|
|
191
201
|
}
|
|
192
202
|
/** 支付记录 metadata,常含 unique_payment_number */
|
|
193
203
|
export interface OrderPaymentMetadata {
|
|
@@ -391,10 +401,12 @@ export interface OrderData {
|
|
|
391
401
|
/** 去掉 bookings 后的订单快照;展开预约行时挂在 {@link BookingData.order} 上 */
|
|
392
402
|
export type OrderWithoutBookings = Omit<OrderData, 'bookings'>;
|
|
393
403
|
/**
|
|
394
|
-
* 展开后的单条预约视图:协议 {@link OrderBookingItem} 平铺字段 + 所属订单(不含 bookings
|
|
404
|
+
* 展开后的单条预约视图:协议 {@link OrderBookingItem} 平铺字段 + 所属订单(不含 bookings)+
|
|
405
|
+
* 当前预约归属的商品行(由订单 products 按 schedule_event_id / relation_items 归集,不修改 order)
|
|
395
406
|
*/
|
|
396
407
|
export type BookingData = OrderBookingItem & {
|
|
397
408
|
order: OrderWithoutBookings;
|
|
409
|
+
products: OrderProductLineItem[];
|
|
398
410
|
};
|
|
399
411
|
/**
|
|
400
412
|
* 订单列表筛选条件(与 order.ts getFilterButtonList 等 UI 对齐)
|
|
@@ -97,7 +97,8 @@
|
|
|
97
97
|
/** 去掉 bookings 后的订单快照;展开预约行时挂在 {@link BookingData.order} 上 */
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
* 展开后的单条预约视图:协议 {@link OrderBookingItem} 平铺字段 + 所属订单(不含 bookings
|
|
100
|
+
* 展开后的单条预约视图:协议 {@link OrderBookingItem} 平铺字段 + 所属订单(不含 bookings)+
|
|
101
|
+
* 当前预约归属的商品行(由订单 products 按 schedule_event_id / relation_items 归集,不修改 order)
|
|
101
102
|
*/
|
|
102
103
|
|
|
103
104
|
/**
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import type { BookingData, BookingFilters, BookingFilterResult, OrderData } from '../types';
|
|
1
|
+
import type { BookingData, BookingFilters, BookingFilterResult, OrderBookingItem, OrderData, OrderProductLineItem } from '../types';
|
|
2
2
|
export type { BookingData, BookingFilters, BookingFilterResult } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* 从整单 `order.products` 中归集属于指定 `booking` 的明细行。
|
|
5
|
+
* - 第一遍:`product.schedule_event_id === booking.schedule_event_id`(保持 products 原顺序)
|
|
6
|
+
* - 第二遍:按 `relation_items` 顺序追加 `resource_id` 与 `order_detail_id` 匹配且尚未收录的行
|
|
7
|
+
*/
|
|
8
|
+
export declare function productsForBooking(order: OrderData, booking: OrderBookingItem): OrderProductLineItem[];
|
|
3
9
|
export declare function flattenOrdersToBookings(orders: OrderData[]): BookingData[];
|
|
4
10
|
export declare function filterBookingsFromOrders(orders: OrderData[], filters: BookingFilters): BookingFilterResult;
|
|
5
11
|
export declare function sortBookings(result: BookingFilterResult, filters: BookingFilters): BookingFilterResult;
|
|
@@ -180,6 +180,61 @@ function matchBooking(booking, orderInfo, ctx) {
|
|
|
180
180
|
return true;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
// ─────────────────────────────────────────────────────────────────
|
|
184
|
+
// 当前预约归属商品:先按 schedule_event_id 命中,再按 relation_items.resource_id 追加(去重保序)
|
|
185
|
+
// ─────────────────────────────────────────────────────────────────
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 从整单 `order.products` 中归集属于指定 `booking` 的明细行。
|
|
189
|
+
* - 第一遍:`product.schedule_event_id === booking.schedule_event_id`(保持 products 原顺序)
|
|
190
|
+
* - 第二遍:按 `relation_items` 顺序追加 `resource_id` 与 `order_detail_id` 匹配且尚未收录的行
|
|
191
|
+
*/
|
|
192
|
+
export function productsForBooking(order, booking) {
|
|
193
|
+
var products = order.products;
|
|
194
|
+
if (!Array.isArray(products) || products.length === 0) return [];
|
|
195
|
+
var bookingEventId = booking.schedule_event_id;
|
|
196
|
+
var byDetailId = new Map();
|
|
197
|
+
for (var i = 0, len = products.length; i < len; i++) {
|
|
198
|
+
var p = products[i];
|
|
199
|
+
var oid = p.order_detail_id;
|
|
200
|
+
if (oid === undefined || oid === null) continue;
|
|
201
|
+
var detailId = Number(oid);
|
|
202
|
+
if (Number.isNaN(detailId)) continue;
|
|
203
|
+
byDetailId.set(detailId, p);
|
|
204
|
+
}
|
|
205
|
+
var seen = new Set();
|
|
206
|
+
var out = [];
|
|
207
|
+
for (var _i = 0, _len = products.length; _i < _len; _i++) {
|
|
208
|
+
var _p = products[_i];
|
|
209
|
+
var _oid = _p.order_detail_id;
|
|
210
|
+
if (_oid === undefined || _oid === null) continue;
|
|
211
|
+
var _detailId = Number(_oid);
|
|
212
|
+
if (Number.isNaN(_detailId)) continue;
|
|
213
|
+
if (bookingEventId !== undefined && bookingEventId !== null && _p.schedule_event_id !== undefined && _p.schedule_event_id !== null && Number(_p.schedule_event_id) === Number(bookingEventId)) {
|
|
214
|
+
if (!seen.has(_detailId)) {
|
|
215
|
+
seen.add(_detailId);
|
|
216
|
+
out.push(_p);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
var relationItems = booking.relation_items;
|
|
221
|
+
if (Array.isArray(relationItems) && relationItems.length > 0) {
|
|
222
|
+
for (var r = 0, rLen = relationItems.length; r < rLen; r++) {
|
|
223
|
+
var _relationItems$r;
|
|
224
|
+
var rid = (_relationItems$r = relationItems[r]) === null || _relationItems$r === void 0 ? void 0 : _relationItems$r.resource_id;
|
|
225
|
+
if (rid === undefined || rid === null) continue;
|
|
226
|
+
var _detailId2 = Number(rid);
|
|
227
|
+
if (Number.isNaN(_detailId2) || seen.has(_detailId2)) continue;
|
|
228
|
+
var line = byDetailId.get(_detailId2);
|
|
229
|
+
if (line) {
|
|
230
|
+
seen.add(_detailId2);
|
|
231
|
+
out.push(line);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return out;
|
|
236
|
+
}
|
|
237
|
+
|
|
183
238
|
// ─────────────────────────────────────────────────────────────────
|
|
184
239
|
// 转换:OrderData[] → BookingData[](独立导出,供其他场景使用)
|
|
185
240
|
// ─────────────────────────────────────────────────────────────────
|
|
@@ -194,8 +249,10 @@ export function flattenOrdersToBookings(orders) {
|
|
|
194
249
|
var _omit = order.bookings,
|
|
195
250
|
orderInfo = _objectWithoutProperties(order, _excluded);
|
|
196
251
|
for (var j = 0, bLen = bookings.length; j < bLen; j++) {
|
|
197
|
-
|
|
198
|
-
|
|
252
|
+
var booking = bookings[j];
|
|
253
|
+
result.push(_objectSpread(_objectSpread({}, booking), {}, {
|
|
254
|
+
order: orderInfo,
|
|
255
|
+
products: productsForBooking(order, booking)
|
|
199
256
|
}));
|
|
200
257
|
}
|
|
201
258
|
}
|
|
@@ -256,7 +313,8 @@ export function filterBookingsFromOrders(orders, filters) {
|
|
|
256
313
|
orderInfo = _rest;
|
|
257
314
|
}
|
|
258
315
|
paginatedList.push(_objectSpread(_objectSpread({}, booking), {}, {
|
|
259
|
-
order: orderInfo
|
|
316
|
+
order: orderInfo,
|
|
317
|
+
products: productsForBooking(order, booking)
|
|
260
318
|
}));
|
|
261
319
|
}
|
|
262
320
|
totalCount++;
|
|
@@ -337,7 +395,9 @@ export function filterBookings(bookings, filters) {
|
|
|
337
395
|
if (!matchOrder(order, ctx)) continue;
|
|
338
396
|
if (!matchBooking(booking, order, ctx)) continue;
|
|
339
397
|
if (totalCount >= startIndex && paginatedList.length < size) {
|
|
340
|
-
paginatedList.push(booking)
|
|
398
|
+
paginatedList.push(_objectSpread(_objectSpread({}, booking), {}, {
|
|
399
|
+
products: productsForBooking(booking.order, booking)
|
|
400
|
+
}));
|
|
341
401
|
}
|
|
342
402
|
totalCount++;
|
|
343
403
|
}
|
package/dist/server/types.d.ts
CHANGED
|
@@ -131,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
131
131
|
* 获取当前的客户搜索条件
|
|
132
132
|
* @returns 当前搜索条件
|
|
133
133
|
*/
|
|
134
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
134
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
135
135
|
/**
|
|
136
136
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
137
137
|
* @returns 客户状态
|
|
@@ -87,10 +87,11 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
87
87
|
/**
|
|
88
88
|
* 标准化单条 booking:
|
|
89
89
|
* - 过滤终态(rejected/cancelled/completed)
|
|
90
|
+
* - 当 deviceTime 早于 currentTime 时,过滤 end_time 早于 currentTime 的历史数据
|
|
90
91
|
* - 注入 status / isTimeout / reserved_status
|
|
91
92
|
*/
|
|
92
93
|
private normalizeMatchedBooking;
|
|
93
|
-
getResourceBookingList(currentTime: string, bookingList?: BookingData[]): Promise<SalesResourceBookingItem[]>;
|
|
94
|
+
getResourceBookingList(currentTime: string, bookingList?: BookingData[], deviceTime?: string): Promise<SalesResourceBookingItem[]>;
|
|
94
95
|
}
|
|
95
96
|
export { SalesImpl as Sales };
|
|
96
97
|
export default SalesImpl;
|
|
@@ -423,18 +423,21 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
423
423
|
/**
|
|
424
424
|
* 标准化单条 booking:
|
|
425
425
|
* - 过滤终态(rejected/cancelled/completed)
|
|
426
|
+
* - 当 deviceTime 早于 currentTime 时,过滤 end_time 早于 currentTime 的历史数据
|
|
426
427
|
* - 注入 status / isTimeout / reserved_status
|
|
427
428
|
*/
|
|
428
429
|
}, {
|
|
429
430
|
key: "normalizeMatchedBooking",
|
|
430
|
-
value: function normalizeMatchedBooking(current, booking) {
|
|
431
|
+
value: function normalizeMatchedBooking(current, deviceCurrent, booking) {
|
|
431
432
|
var _ref3, _booking$appointment_;
|
|
432
433
|
var appointmentStatus = String((_ref3 = (_booking$appointment_ = booking.appointment_status) !== null && _booking$appointment_ !== void 0 ? _booking$appointment_ : booking.status) !== null && _ref3 !== void 0 ? _ref3 : '');
|
|
433
434
|
if (appointmentStatus === 'rejected' || appointmentStatus === 'cancelled' || appointmentStatus === 'completed') {
|
|
434
435
|
return null;
|
|
435
436
|
}
|
|
436
|
-
var bookingStatus = this.getBookingStatus(appointmentStatus);
|
|
437
437
|
var endAt = this.toBookingDateTime(booking.end_date, booking.end_time);
|
|
438
|
+
var shouldFilterHistoryByCurrent = deviceCurrent.isBefore(current);
|
|
439
|
+
if (shouldFilterHistoryByCurrent && endAt.isValid() && endAt.isBefore(current)) return null;
|
|
440
|
+
var bookingStatus = this.getBookingStatus(appointmentStatus);
|
|
438
441
|
var startAt = this.toBookingDateTime(booking.start_date, booking.start_time);
|
|
439
442
|
var isTimeout = bookingStatus === 'occupied' && endAt.isValid() && current.isAfter(endAt);
|
|
440
443
|
var timeoutTime = isTimeout ? current.diff(endAt, 'minute') : undefined;
|
|
@@ -478,7 +481,9 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
478
481
|
_resourceResponse$dat2,
|
|
479
482
|
_this3 = this;
|
|
480
483
|
var bookingList,
|
|
484
|
+
deviceTime,
|
|
481
485
|
current,
|
|
486
|
+
deviceCurrent,
|
|
482
487
|
resourceResponse,
|
|
483
488
|
resourceList,
|
|
484
489
|
normalizedBookings,
|
|
@@ -488,15 +493,23 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
488
493
|
while (1) switch (_context3.prev = _context3.next) {
|
|
489
494
|
case 0:
|
|
490
495
|
bookingList = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : [];
|
|
496
|
+
deviceTime = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : currentTime;
|
|
491
497
|
// currentTime 约定为完整 datetime;非法值直接返回空,避免误判
|
|
492
498
|
current = dayjs(currentTime);
|
|
493
499
|
if (current.isValid()) {
|
|
494
|
-
_context3.next =
|
|
500
|
+
_context3.next = 5;
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
return _context3.abrupt("return", []);
|
|
504
|
+
case 5:
|
|
505
|
+
deviceCurrent = dayjs(deviceTime);
|
|
506
|
+
if (deviceCurrent.isValid()) {
|
|
507
|
+
_context3.next = 8;
|
|
495
508
|
break;
|
|
496
509
|
}
|
|
497
510
|
return _context3.abrupt("return", []);
|
|
498
|
-
case
|
|
499
|
-
_context3.next =
|
|
511
|
+
case 8:
|
|
512
|
+
_context3.next = 10;
|
|
500
513
|
return this.request.get('/shop/form/resource/page', {
|
|
501
514
|
skip: 1,
|
|
502
515
|
num: 999
|
|
@@ -506,18 +519,18 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
506
519
|
osServer: true,
|
|
507
520
|
isShopApi: true
|
|
508
521
|
});
|
|
509
|
-
case
|
|
522
|
+
case 10:
|
|
510
523
|
resourceResponse = _context3.sent;
|
|
511
524
|
resourceList = (_resourceResponse$dat = resourceResponse === null || resourceResponse === void 0 || (_resourceResponse$dat2 = resourceResponse.data) === null || _resourceResponse$dat2 === void 0 ? void 0 : _resourceResponse$dat2.list) !== null && _resourceResponse$dat !== void 0 ? _resourceResponse$dat : [];
|
|
512
525
|
if (!(!Array.isArray(resourceList) || resourceList.length === 0)) {
|
|
513
|
-
_context3.next =
|
|
526
|
+
_context3.next = 14;
|
|
514
527
|
break;
|
|
515
528
|
}
|
|
516
529
|
return _context3.abrupt("return", []);
|
|
517
|
-
case
|
|
530
|
+
case 14:
|
|
518
531
|
// 全局先做 booking 标准化 + start_time 升序,后续映射直接复用
|
|
519
532
|
normalizedBookings = bookingList.map(function (booking) {
|
|
520
|
-
return _this3.normalizeMatchedBooking(current, booking);
|
|
533
|
+
return _this3.normalizeMatchedBooking(current, deviceCurrent, booking);
|
|
521
534
|
}).filter(function (booking) {
|
|
522
535
|
return Boolean(booking);
|
|
523
536
|
}).sort(function (left, right) {
|
|
@@ -548,7 +561,7 @@ export var SalesImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
548
561
|
bookings: bookings
|
|
549
562
|
});
|
|
550
563
|
}));
|
|
551
|
-
case
|
|
564
|
+
case 18:
|
|
552
565
|
case "end":
|
|
553
566
|
return _context3.stop();
|
|
554
567
|
}
|
|
@@ -61,7 +61,7 @@ export interface SalesModuleAPI {
|
|
|
61
61
|
/** 重置预约列表为空 */
|
|
62
62
|
resetReservationList: () => Reservation[];
|
|
63
63
|
/** 获取资源维度的预约占用列表 */
|
|
64
|
-
getResourceBookingList: (currentTime: string, bookingList: BookingData[]) => Promise<SalesResourceBookingItem[]>;
|
|
64
|
+
getResourceBookingList: (currentTime: string, bookingList: BookingData[], deviceTime?: string) => Promise<SalesResourceBookingItem[]>;
|
|
65
65
|
/** 获取时间轴每个时间片的预约数量 */
|
|
66
66
|
getTimelineHighlights: (bookingList: BookingData[], startDateTime?: string, endDateTime?: string) => SalesTimelineHighlights;
|
|
67
67
|
}
|
|
@@ -23,7 +23,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
23
23
|
*/
|
|
24
24
|
private logError;
|
|
25
25
|
createOrder(params: CommitOrderParams['query']): {
|
|
26
|
-
type: "
|
|
26
|
+
type: "virtual" | "appointment_booking";
|
|
27
27
|
platform: string;
|
|
28
28
|
sales_channel: string;
|
|
29
29
|
order_sales_channel: string;
|
package/lib/server/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { MenuModule } from './modules/menu';
|
|
|
3
3
|
import { QuotationModule } from './modules/quotation';
|
|
4
4
|
import { ScheduleModuleEx } from './modules/schedule';
|
|
5
5
|
import { ResourceModule } from './modules/resource';
|
|
6
|
+
import { FloorPlanModule } from './modules/floor-plan';
|
|
6
7
|
import { PisellCore, ServerModuleConfig, InitializeServerOptions } from '../types';
|
|
7
8
|
import type { RouteHandler, HttpMethod, RouteDefinition, Router, ModuleRegistryConfig, RequestSetting } from './types';
|
|
8
9
|
import { OrderModule } from './modules/order';
|
|
@@ -21,10 +22,14 @@ declare class Server {
|
|
|
21
22
|
schedule?: ScheduleModuleEx;
|
|
22
23
|
resource?: ResourceModule;
|
|
23
24
|
order?: OrderModule;
|
|
25
|
+
floor_plan?: FloorPlanModule;
|
|
26
|
+
/** GET 前缀路由(最长前缀优先匹配) */
|
|
27
|
+
private prefixRouterGet;
|
|
24
28
|
router: Router;
|
|
25
29
|
private productQuerySubscribers;
|
|
26
30
|
private orderQuerySubscribers;
|
|
27
31
|
private bookingQuerySubscribers;
|
|
32
|
+
private floorPlanQuerySubscribers;
|
|
28
33
|
private moduleRegistry;
|
|
29
34
|
constructor(core: PisellCore);
|
|
30
35
|
/**
|
|
@@ -32,6 +37,10 @@ declare class Server {
|
|
|
32
37
|
* @param routes 路由定义数组
|
|
33
38
|
*/
|
|
34
39
|
private registerRoutes;
|
|
40
|
+
/**
|
|
41
|
+
* 注册前缀路由(仅 GET)。匹配规则:path === prefix 或 path 以 prefix + '/' 开头;最长前缀优先。
|
|
42
|
+
*/
|
|
43
|
+
private registerPrefixRoutes;
|
|
35
44
|
/**
|
|
36
45
|
* 注册单个模块并自动注册其路由
|
|
37
46
|
* @param module 模块实例
|
|
@@ -184,6 +193,27 @@ declare class Server {
|
|
|
184
193
|
* 转发到资源模块去
|
|
185
194
|
*/
|
|
186
195
|
private handleResourceList;
|
|
196
|
+
/**
|
|
197
|
+
* 从 url 或路由 path 解析 pathname(不含 query,去掉末尾 /)
|
|
198
|
+
*/
|
|
199
|
+
private parseRequestPath;
|
|
200
|
+
/**
|
|
201
|
+
* 解析平面图 GET 路径为查询上下文
|
|
202
|
+
*/
|
|
203
|
+
private resolveFloorPlanQueryContext;
|
|
204
|
+
/**
|
|
205
|
+
* GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
|
|
206
|
+
*/
|
|
207
|
+
private handleFloorPlanGet;
|
|
208
|
+
private computeFloorPlanQueryResult;
|
|
209
|
+
/**
|
|
210
|
+
* 平面图数据变更后向所有 GET 订阅者推送最新结果
|
|
211
|
+
*/
|
|
212
|
+
private recomputeAndNotifyFloorPlanQuery;
|
|
213
|
+
/**
|
|
214
|
+
* 取消平面图 GET 订阅(也可走 GET .../unsubscribe + subscriberId)
|
|
215
|
+
*/
|
|
216
|
+
removeFloorPlanQuerySubscriber(subscriberId?: string): void;
|
|
187
217
|
/**
|
|
188
218
|
* 取消预约列表查询订阅(HTTP 路由入口)
|
|
189
219
|
*/
|