@pisell/pisellos 0.10.91 → 0.10.94
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/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +21 -6
- package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +11 -11
- package/dist/solution/BookingTicket/utils/redeemArrival.js +11 -5
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +17 -1
- package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +11 -11
- package/lib/solution/BookingTicket/utils/redeemArrival.js +11 -5
- package/package.json +1 -1
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "normal" | "session";
|
|
53
53
|
}
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
date: string;
|
|
343
343
|
status: string;
|
|
344
344
|
week: string;
|
|
345
|
-
weekNum: 0 | 2 | 1 |
|
|
345
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
346
346
|
}[]>;
|
|
347
347
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
348
348
|
private getScheduleDataByIds;
|
|
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
389
389
|
};
|
|
390
390
|
setOtherData(key: string, value: any): void;
|
|
391
391
|
getOtherData(key: string): any;
|
|
392
|
-
getProductTypeById(id: number): Promise<"
|
|
392
|
+
getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
|
|
393
393
|
/**
|
|
394
394
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
395
395
|
*
|
|
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
366
366
|
* 获取当前的客户搜索条件
|
|
367
367
|
* @returns 当前搜索条件
|
|
368
368
|
*/
|
|
369
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
369
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
370
370
|
/**
|
|
371
371
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
372
372
|
* @returns 客户状态
|
|
@@ -600,6 +600,10 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
600
600
|
private getDeviceTaskPlugin;
|
|
601
601
|
handlePrintWristband(params: {
|
|
602
602
|
voucher_ids: number[];
|
|
603
|
+
voucher_times?: Record<string, {
|
|
604
|
+
start_time: string;
|
|
605
|
+
end_time: string;
|
|
606
|
+
}>;
|
|
603
607
|
}): Promise<void>;
|
|
604
608
|
private redeemStatusWrite?;
|
|
605
609
|
private arrivalQueue;
|
|
@@ -3572,10 +3572,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3572
3572
|
device_id: deviceId,
|
|
3573
3573
|
payload: {
|
|
3574
3574
|
type: 'WRISTBAND',
|
|
3575
|
-
data: {
|
|
3576
|
-
order_id: (_this$getOrderIdentit2 = this.getOrderIdentity()) === null || _this$getOrderIdentit2 === void 0 ? void 0 : _this$getOrderIdentit2.orderId
|
|
3575
|
+
data: _objectSpread(_objectSpread({
|
|
3576
|
+
order_id: (_this$getOrderIdentit2 = this.getOrderIdentity()) === null || _this$getOrderIdentit2 === void 0 ? void 0 : _this$getOrderIdentit2.orderId
|
|
3577
|
+
}, params.voucher_times && {
|
|
3578
|
+
voucher_times: params.voucher_times
|
|
3579
|
+
}), {}, {
|
|
3577
3580
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
3578
|
-
}
|
|
3581
|
+
})
|
|
3579
3582
|
},
|
|
3580
3583
|
idempotency_key: idempotencyKey,
|
|
3581
3584
|
name: 'PRINT_WRISTBAND',
|
|
@@ -3723,7 +3726,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3723
3726
|
updateArrival = /*#__PURE__*/function () {
|
|
3724
3727
|
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
|
|
3725
3728
|
var _this14$store$order, _this14$store$order$g, _next$summary;
|
|
3726
|
-
var current, sameOrder, order, arrival, next, query, checkout, latest, patch;
|
|
3729
|
+
var current, sameOrder, order, arrival, next, query, checkout, latest, patch, voucherTimes;
|
|
3727
3730
|
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
|
3728
3731
|
while (1) switch (_context47.prev = _context47.next) {
|
|
3729
3732
|
case 0:
|
|
@@ -3841,8 +3844,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3841
3844
|
reason: 'order_changed'
|
|
3842
3845
|
});
|
|
3843
3846
|
case 53:
|
|
3844
|
-
|
|
3845
|
-
|
|
3847
|
+
// 从本次 checkout 已接受的快照取票面时间,避免打印接口短暂返回旧值。
|
|
3848
|
+
voucherTimes = {};
|
|
3849
|
+
arrival.vouchers.forEach(function (voucher, index) {
|
|
3850
|
+
if (voucher !== order.vouchers[index] && voucher.voucher_id != null && voucher.start_time && voucher.end_time) {
|
|
3851
|
+
voucherTimes[String(voucher.voucher_id)] = {
|
|
3852
|
+
start_time: voucher.start_time,
|
|
3853
|
+
end_time: voucher.end_time
|
|
3854
|
+
};
|
|
3855
|
+
}
|
|
3856
|
+
});
|
|
3857
|
+
return _context47.abrupt("return", Object.keys(voucherTimes).length ? _objectSpread(_objectSpread({}, checkout), {}, {
|
|
3858
|
+
voucher_times: voucherTimes
|
|
3859
|
+
}) : checkout);
|
|
3860
|
+
case 56:
|
|
3846
3861
|
case "end":
|
|
3847
3862
|
return _context47.stop();
|
|
3848
3863
|
}
|
|
@@ -24,20 +24,13 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
24
24
|
products: import("../../../modules/Order/types").OrderSubmitProduct[];
|
|
25
25
|
notes?: import("../../../modules/Order/types").SalesNote[] | undefined;
|
|
26
26
|
summary?: import("../../../modules/Order/types").OrderSummary | undefined;
|
|
27
|
-
|
|
28
|
-
type: string;
|
|
29
|
-
note: string;
|
|
30
|
-
holder: Record<string, any> | null;
|
|
31
|
-
relation_forms: any[];
|
|
32
|
-
holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
|
|
33
|
-
phone: string;
|
|
34
|
-
email: string;
|
|
35
|
-
contacts_info: Record<string, any> | null;
|
|
27
|
+
bookings: any[];
|
|
36
28
|
order_id: number | null;
|
|
37
29
|
external_sale_number: string;
|
|
38
30
|
order_number: string | null;
|
|
39
31
|
shop_order_number: string | null;
|
|
40
32
|
shop_full_order_number: string | null;
|
|
33
|
+
type: string;
|
|
41
34
|
business_code?: string | undefined;
|
|
42
35
|
sales_channel: string;
|
|
43
36
|
order_sales_channel: string;
|
|
@@ -46,6 +39,8 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
46
39
|
customer_id: number | null;
|
|
47
40
|
customer_name: string;
|
|
48
41
|
country_calling_code: string;
|
|
42
|
+
phone: string;
|
|
43
|
+
email: string;
|
|
49
44
|
is_price_include_tax: number;
|
|
50
45
|
tax_title: string;
|
|
51
46
|
tax_country_code: string;
|
|
@@ -56,16 +51,21 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
56
51
|
deposit_amount: string;
|
|
57
52
|
shop_discount: string;
|
|
58
53
|
surcharge_fee: string;
|
|
54
|
+
note: string;
|
|
59
55
|
buzzer?: string | undefined;
|
|
60
56
|
delivery_type?: string | undefined;
|
|
61
57
|
table_number?: Record<string, any> | undefined;
|
|
62
58
|
schedule_date: string;
|
|
63
|
-
|
|
59
|
+
holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
|
|
64
60
|
payments: any[];
|
|
65
|
-
order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
|
|
66
61
|
refunds?: any[] | undefined;
|
|
67
62
|
surcharges: any[];
|
|
63
|
+
relation_forms: any[];
|
|
68
64
|
contacts: any[];
|
|
65
|
+
contacts_info: Record<string, any> | null;
|
|
66
|
+
holder: Record<string, any> | null;
|
|
67
|
+
order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
|
|
68
|
+
metadata: Record<string, any>;
|
|
69
69
|
};
|
|
70
70
|
export declare function describeChangedBookings(before: OrderTempOrder['bookings'], after: OrderTempOrder['bookings']): {
|
|
71
71
|
schedule_event_id: any;
|
|
@@ -33,13 +33,14 @@ export function readArrivalWindow(config) {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
function shiftedSession(booking, now, window) {
|
|
36
|
-
if (!window || !booking.start_date || !booking.start_time || !booking.end_time) return;
|
|
36
|
+
if (!window || !booking.start_date || !booking.start_time || !booking.end_time) return null;
|
|
37
37
|
var start = dayjs("".concat(booking.start_date, " ").concat(booking.start_time));
|
|
38
38
|
var end = dayjs("".concat(booking.end_date || booking.start_date, " ").concat(booking.end_time));
|
|
39
|
-
if (!start.isValid() || !end.isValid() || end.isBefore(start)) return;
|
|
39
|
+
if (!start.isValid() || !end.isValid() || end.isBefore(start)) return null;
|
|
40
40
|
var delta = dayjs(now).startOf('minute').diff(start, 'minute');
|
|
41
41
|
var minutes = Math.max(-window.earlyMinutes, Math.min(window.lateMinutes, delta));
|
|
42
|
-
if (!Number.isFinite(minutes)
|
|
42
|
+
if (!Number.isFinite(minutes)) return null;
|
|
43
|
+
if (!minutes) return;
|
|
43
44
|
var shiftedStart = start.add(minutes, 'minute');
|
|
44
45
|
var shiftedEnd = end.add(minutes, 'minute');
|
|
45
46
|
return {
|
|
@@ -70,16 +71,21 @@ export function applyRedeemArrival(order, ids, now, window, onSkip) {
|
|
|
70
71
|
_iterator.f();
|
|
71
72
|
}
|
|
72
73
|
var alreadyMarked = false;
|
|
74
|
+
var invalidSession = false;
|
|
73
75
|
var changes = new Map();
|
|
74
76
|
var bookings = order.bookings.map(function (booking) {
|
|
75
77
|
var _booking$metadata;
|
|
76
78
|
var event = redeemEventKey(booking === null || booking === void 0 ? void 0 : booking.schedule_event_id);
|
|
77
|
-
if (!event || !selected.has(event) || booking.parent_id === 0) return booking;
|
|
79
|
+
if (!event || !selected.has(event) || String(booking.parent_id) === '0') return booking;
|
|
78
80
|
if (Number((_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.is_change_by_redeem) === 1) {
|
|
79
81
|
alreadyMarked = true;
|
|
80
82
|
return booking;
|
|
81
83
|
}
|
|
82
84
|
var shift = shiftedSession(booking, now, window);
|
|
85
|
+
if (shift === null) {
|
|
86
|
+
invalidSession = true;
|
|
87
|
+
return booking;
|
|
88
|
+
}
|
|
83
89
|
// 准点核销的偏移量为零,也要打标,避免下一张票改变这个时段。
|
|
84
90
|
changes.set(event, shift);
|
|
85
91
|
return _objectSpread(_objectSpread(_objectSpread({}, booking), shift), {}, {
|
|
@@ -89,7 +95,7 @@ export function applyRedeemArrival(order, ids, now, window, onSkip) {
|
|
|
89
95
|
});
|
|
90
96
|
});
|
|
91
97
|
if (!changes.size) {
|
|
92
|
-
onSkip === null || onSkip === void 0 || onSkip(alreadyMarked ? 'already_marked' : 'no_linked_booking');
|
|
98
|
+
onSkip === null || onSkip === void 0 || onSkip(invalidSession ? 'invalid_booking_time' : alreadyMarked ? 'already_marked' : 'no_linked_booking');
|
|
93
99
|
return;
|
|
94
100
|
}
|
|
95
101
|
var vouchers = order.vouchers.map(function (voucher) {
|
|
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
|
|
|
49
49
|
getCategories(): ProductCategory[];
|
|
50
50
|
setOtherParams(key: string, value: any): void;
|
|
51
51
|
getOtherParams(): any;
|
|
52
|
-
getProductType(): "
|
|
52
|
+
getProductType(): "duration" | "normal" | "session";
|
|
53
53
|
}
|
|
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
342
342
|
date: string;
|
|
343
343
|
status: string;
|
|
344
344
|
week: string;
|
|
345
|
-
weekNum: 0 | 2 | 1 |
|
|
345
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
346
346
|
}[]>;
|
|
347
347
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
348
348
|
private getScheduleDataByIds;
|
|
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
389
389
|
};
|
|
390
390
|
setOtherData(key: string, value: any): void;
|
|
391
391
|
getOtherData(key: string): any;
|
|
392
|
-
getProductTypeById(id: number): Promise<"
|
|
392
|
+
getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
|
|
393
393
|
/**
|
|
394
394
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
395
395
|
*
|
|
@@ -366,7 +366,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
366
366
|
* 获取当前的客户搜索条件
|
|
367
367
|
* @returns 当前搜索条件
|
|
368
368
|
*/
|
|
369
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
369
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
|
|
370
370
|
/**
|
|
371
371
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
372
372
|
* @returns 客户状态
|
|
@@ -600,6 +600,10 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
600
600
|
private getDeviceTaskPlugin;
|
|
601
601
|
handlePrintWristband(params: {
|
|
602
602
|
voucher_ids: number[];
|
|
603
|
+
voucher_times?: Record<string, {
|
|
604
|
+
start_time: string;
|
|
605
|
+
end_time: string;
|
|
606
|
+
}>;
|
|
603
607
|
}): Promise<void>;
|
|
604
608
|
private redeemStatusWrite?;
|
|
605
609
|
private arrivalQueue;
|
|
@@ -2116,6 +2116,9 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
2116
2116
|
type: 'WRISTBAND',
|
|
2117
2117
|
data: {
|
|
2118
2118
|
order_id: this.getOrderIdentity()?.orderId,
|
|
2119
|
+
...(params.voucher_times && {
|
|
2120
|
+
voucher_times: params.voucher_times
|
|
2121
|
+
}),
|
|
2119
2122
|
voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
|
|
2120
2123
|
}
|
|
2121
2124
|
},
|
|
@@ -2270,7 +2273,20 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
2270
2273
|
reason: 'order_changed'
|
|
2271
2274
|
});
|
|
2272
2275
|
}
|
|
2273
|
-
|
|
2276
|
+
// 从本次 checkout 已接受的快照取票面时间,避免打印接口短暂返回旧值。
|
|
2277
|
+
const voucherTimes = {};
|
|
2278
|
+
arrival.vouchers.forEach((voucher, index) => {
|
|
2279
|
+
if (voucher !== order.vouchers[index] && voucher.voucher_id != null && voucher.start_time && voucher.end_time) {
|
|
2280
|
+
voucherTimes[String(voucher.voucher_id)] = {
|
|
2281
|
+
start_time: voucher.start_time,
|
|
2282
|
+
end_time: voucher.end_time
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
});
|
|
2286
|
+
return Object.keys(voucherTimes).length ? {
|
|
2287
|
+
...checkout,
|
|
2288
|
+
voucher_times: voucherTimes
|
|
2289
|
+
} : checkout;
|
|
2274
2290
|
};
|
|
2275
2291
|
const completion = this.arrivalQueue.then(updateArrival).catch(error => {
|
|
2276
2292
|
log('failed', {
|
|
@@ -24,20 +24,13 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
24
24
|
products: import("../../../modules/Order/types").OrderSubmitProduct[];
|
|
25
25
|
notes?: import("../../../modules/Order/types").SalesNote[] | undefined;
|
|
26
26
|
summary?: import("../../../modules/Order/types").OrderSummary | undefined;
|
|
27
|
-
|
|
28
|
-
type: string;
|
|
29
|
-
note: string;
|
|
30
|
-
holder: Record<string, any> | null;
|
|
31
|
-
relation_forms: any[];
|
|
32
|
-
holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
|
|
33
|
-
phone: string;
|
|
34
|
-
email: string;
|
|
35
|
-
contacts_info: Record<string, any> | null;
|
|
27
|
+
bookings: any[];
|
|
36
28
|
order_id: number | null;
|
|
37
29
|
external_sale_number: string;
|
|
38
30
|
order_number: string | null;
|
|
39
31
|
shop_order_number: string | null;
|
|
40
32
|
shop_full_order_number: string | null;
|
|
33
|
+
type: string;
|
|
41
34
|
business_code?: string | undefined;
|
|
42
35
|
sales_channel: string;
|
|
43
36
|
order_sales_channel: string;
|
|
@@ -46,6 +39,8 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
46
39
|
customer_id: number | null;
|
|
47
40
|
customer_name: string;
|
|
48
41
|
country_calling_code: string;
|
|
42
|
+
phone: string;
|
|
43
|
+
email: string;
|
|
49
44
|
is_price_include_tax: number;
|
|
50
45
|
tax_title: string;
|
|
51
46
|
tax_country_code: string;
|
|
@@ -56,16 +51,21 @@ export declare function buildArrivalCheckoutQuery(order: OrderTempOrder, summary
|
|
|
56
51
|
deposit_amount: string;
|
|
57
52
|
shop_discount: string;
|
|
58
53
|
surcharge_fee: string;
|
|
54
|
+
note: string;
|
|
59
55
|
buzzer?: string | undefined;
|
|
60
56
|
delivery_type?: string | undefined;
|
|
61
57
|
table_number?: Record<string, any> | undefined;
|
|
62
58
|
schedule_date: string;
|
|
63
|
-
|
|
59
|
+
holder_relations?: import("../../../modules/Order/types").OrderHolderRelation[] | undefined;
|
|
64
60
|
payments: any[];
|
|
65
|
-
order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
|
|
66
61
|
refunds?: any[] | undefined;
|
|
67
62
|
surcharges: any[];
|
|
63
|
+
relation_forms: any[];
|
|
68
64
|
contacts: any[];
|
|
65
|
+
contacts_info: Record<string, any> | null;
|
|
66
|
+
holder: Record<string, any> | null;
|
|
67
|
+
order_meta_list?: import("../../../modules/Order/types").OrderMetaList | undefined;
|
|
68
|
+
metadata: Record<string, any>;
|
|
69
69
|
};
|
|
70
70
|
export declare function describeChangedBookings(before: OrderTempOrder['bookings'], after: OrderTempOrder['bookings']): {
|
|
71
71
|
schedule_event_id: any;
|
|
@@ -28,13 +28,14 @@ function readArrivalWindow(config) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
function shiftedSession(booking, now, window) {
|
|
31
|
-
if (!window || !booking.start_date || !booking.start_time || !booking.end_time) return;
|
|
31
|
+
if (!window || !booking.start_date || !booking.start_time || !booking.end_time) return null;
|
|
32
32
|
const start = (0, _dayjs.default)(`${booking.start_date} ${booking.start_time}`);
|
|
33
33
|
const end = (0, _dayjs.default)(`${booking.end_date || booking.start_date} ${booking.end_time}`);
|
|
34
|
-
if (!start.isValid() || !end.isValid() || end.isBefore(start)) return;
|
|
34
|
+
if (!start.isValid() || !end.isValid() || end.isBefore(start)) return null;
|
|
35
35
|
const delta = (0, _dayjs.default)(now).startOf('minute').diff(start, 'minute');
|
|
36
36
|
const minutes = Math.max(-window.earlyMinutes, Math.min(window.lateMinutes, delta));
|
|
37
|
-
if (!Number.isFinite(minutes)
|
|
37
|
+
if (!Number.isFinite(minutes)) return null;
|
|
38
|
+
if (!minutes) return;
|
|
38
39
|
const shiftedStart = start.add(minutes, 'minute');
|
|
39
40
|
const shiftedEnd = end.add(minutes, 'minute');
|
|
40
41
|
return {
|
|
@@ -55,15 +56,20 @@ function applyRedeemArrival(order, ids, now, window, onSkip) {
|
|
|
55
56
|
if (event && ids.has(String(voucher.voucher_id))) selected.add(event);
|
|
56
57
|
}
|
|
57
58
|
let alreadyMarked = false;
|
|
59
|
+
let invalidSession = false;
|
|
58
60
|
const changes = new Map();
|
|
59
61
|
const bookings = order.bookings.map(booking => {
|
|
60
62
|
const event = (0, _utils.redeemEventKey)(booking?.schedule_event_id);
|
|
61
|
-
if (!event || !selected.has(event) || booking.parent_id === 0) return booking;
|
|
63
|
+
if (!event || !selected.has(event) || String(booking.parent_id) === '0') return booking;
|
|
62
64
|
if (Number(booking.metadata?.is_change_by_redeem) === 1) {
|
|
63
65
|
alreadyMarked = true;
|
|
64
66
|
return booking;
|
|
65
67
|
}
|
|
66
68
|
const shift = shiftedSession(booking, now, window);
|
|
69
|
+
if (shift === null) {
|
|
70
|
+
invalidSession = true;
|
|
71
|
+
return booking;
|
|
72
|
+
}
|
|
67
73
|
// 准点核销的偏移量为零,也要打标,避免下一张票改变这个时段。
|
|
68
74
|
changes.set(event, shift);
|
|
69
75
|
return {
|
|
@@ -76,7 +82,7 @@ function applyRedeemArrival(order, ids, now, window, onSkip) {
|
|
|
76
82
|
};
|
|
77
83
|
});
|
|
78
84
|
if (!changes.size) {
|
|
79
|
-
onSkip?.(alreadyMarked ? 'already_marked' : 'no_linked_booking');
|
|
85
|
+
onSkip?.(invalidSession ? 'invalid_booking_time' : alreadyMarked ? 'already_marked' : 'no_linked_booking');
|
|
80
86
|
return;
|
|
81
87
|
}
|
|
82
88
|
const vouchers = order.vouchers.map(voucher => {
|