@pisell/pisellos 2.3.129 → 2.3.130
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/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/index.js +407 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/FulfillmentTiming/types.js +1 -0
- package/dist/modules/OpenData/types.d.ts +6 -0
- package/dist/modules/Order/index.d.ts +6 -0
- package/dist/modules/Order/index.js +55 -12
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/pickupTiming.js +53 -0
- package/dist/modules/Order/types.d.ts +5 -1
- package/dist/modules/Order/utils.js +16 -6
- package/dist/modules/Payment/index.js +9 -10
- package/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +141 -39
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/request.d.ts +7 -0
- package/dist/server/utils/small-ticket.d.ts +1 -85
- package/dist/server/utils/small-ticket.js +2 -2542
- package/dist/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/dist/shared/payment/loadPaymentMethods.js +66 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts +22 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.js +142 -0
- package/dist/shared/receipt/small-ticket.d.ts +85 -0
- package/dist/shared/receipt/small-ticket.js +2576 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.js +21 -0
- package/dist/solution/BaseSales/index.d.ts +24 -0
- package/dist/solution/BaseSales/index.js +1221 -1038
- package/dist/solution/BaseSales/pickupTiming.d.ts +43 -0
- package/dist/solution/BaseSales/pickupTiming.js +589 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +3 -3
- package/dist/solution/BookingTicket/utils/cartView.js +3 -1
- package/dist/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/dist/solution/OrderInvoicePreview/index.js +269 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +13 -4
- package/dist/solution/UnifiedBookingSales/index.js +872 -707
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +21 -1
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/index.js +359 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/FulfillmentTiming/types.js +5 -0
- package/lib/modules/OpenData/types.d.ts +6 -0
- package/lib/modules/Order/index.d.ts +6 -0
- package/lib/modules/Order/index.js +39 -8
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/pickupTiming.js +61 -0
- package/lib/modules/Order/types.d.ts +5 -1
- package/lib/modules/Order/utils.js +12 -4
- package/lib/modules/Payment/index.js +3 -4
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +68 -12
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +11 -0
- package/lib/plugins/request.d.ts +7 -0
- package/lib/server/utils/small-ticket.d.ts +1 -85
- package/lib/server/utils/small-ticket.js +9 -2305
- package/lib/shared/payment/loadPaymentMethods.d.ts +9 -0
- package/lib/shared/payment/loadPaymentMethods.js +40 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.d.ts +22 -0
- package/lib/shared/receipt/loadCustomerInvoiceLayout.js +86 -0
- package/lib/shared/receipt/small-ticket.d.ts +85 -0
- package/lib/shared/receipt/small-ticket.js +2342 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.d.ts +9 -0
- package/lib/shared/sales/loadSalesOrderSnapshot.js +22 -0
- package/lib/solution/BaseSales/index.d.ts +24 -0
- package/lib/solution/BaseSales/index.js +97 -1
- package/lib/solution/BaseSales/pickupTiming.d.ts +43 -0
- package/lib/solution/BaseSales/pickupTiming.js +269 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +3 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +3 -3
- package/lib/solution/BookingTicket/utils/cartView.js +3 -1
- package/lib/solution/OrderInvoicePreview/index.d.ts +56 -0
- package/lib/solution/OrderInvoicePreview/index.js +192 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +13 -4
- package/lib/solution/UnifiedBookingSales/index.js +130 -46
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type PickupTimingSelectionMode = 'asap' | 'scheduled';
|
|
2
|
+
export type PickupTimingSource = 'asap' | 'schedule' | 'pos_manual';
|
|
3
|
+
export interface PickupTimingBookingInput {
|
|
4
|
+
mode: PickupTimingSelectionMode;
|
|
5
|
+
source: PickupTimingSource;
|
|
6
|
+
/** Store-local calendar date and minute; the caller validates availability. */
|
|
7
|
+
date: string;
|
|
8
|
+
time: string;
|
|
9
|
+
/** Absolute timestamp disambiguates a repeated local minute at a DST change. */
|
|
10
|
+
instant?: string;
|
|
11
|
+
timezone?: string;
|
|
12
|
+
frozen?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PickupTimingBookingMetadata {
|
|
15
|
+
unique_identification_number: string;
|
|
16
|
+
is_fulfillment_timing: true;
|
|
17
|
+
fulfillment_timing: {
|
|
18
|
+
method: 'pick_up';
|
|
19
|
+
mode: PickupTimingSelectionMode;
|
|
20
|
+
source: PickupTimingSource;
|
|
21
|
+
instant?: string;
|
|
22
|
+
timezone?: string;
|
|
23
|
+
frozen?: boolean;
|
|
24
|
+
};
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export interface PickupTimingBooking {
|
|
28
|
+
schedule_id: number | string;
|
|
29
|
+
start_date: string;
|
|
30
|
+
end_date: string;
|
|
31
|
+
start_time: string;
|
|
32
|
+
end_time: string;
|
|
33
|
+
select_date: string;
|
|
34
|
+
duration: 0;
|
|
35
|
+
is_all: 0;
|
|
36
|
+
sub_type: 'minutes';
|
|
37
|
+
like_status: string;
|
|
38
|
+
resources: [];
|
|
39
|
+
metadata: PickupTimingBookingMetadata;
|
|
40
|
+
schedule_event_id?: number | string;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
/** The explicit marker is the only authority; unlinked ordinary bookings remain ordinary. */
|
|
44
|
+
export declare function isFulfillmentTimingBooking(booking: unknown): boolean;
|
|
45
|
+
/** Update an independent pickup appointment without changing its persisted row identity. */
|
|
46
|
+
export declare function buildPickupTimingBooking(input: PickupTimingBookingInput, existing?: Record<string, any> | null): PickupTimingBooking;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildPickupTimingBooking = buildPickupTimingBooking;
|
|
7
|
+
exports.isFulfillmentTimingBooking = isFulfillmentTimingBooking;
|
|
8
|
+
var _orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
9
|
+
/** The explicit marker is the only authority; unlinked ordinary bookings remain ordinary. */
|
|
10
|
+
function isFulfillmentTimingBooking(booking) {
|
|
11
|
+
return booking?.metadata?.is_fulfillment_timing === true;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Update an independent pickup appointment without changing its persisted row identity. */
|
|
15
|
+
function buildPickupTimingBooking(input, existing) {
|
|
16
|
+
const booking = {
|
|
17
|
+
...(existing || {})
|
|
18
|
+
};
|
|
19
|
+
const metadata = {
|
|
20
|
+
...(booking.metadata || {})
|
|
21
|
+
};
|
|
22
|
+
// A fulfillment appointment never becomes a product/resource/holder purchase line.
|
|
23
|
+
for (const key of ['product_uid', 'product', 'holder', 'holder_id', 'collect_pax', 'capacity']) {
|
|
24
|
+
delete booking[key];
|
|
25
|
+
delete metadata[key];
|
|
26
|
+
}
|
|
27
|
+
delete metadata.booking_uid;
|
|
28
|
+
return {
|
|
29
|
+
...booking,
|
|
30
|
+
schedule_id: booking.schedule_id || 0,
|
|
31
|
+
start_date: input.date,
|
|
32
|
+
end_date: input.date,
|
|
33
|
+
start_time: input.time,
|
|
34
|
+
end_time: input.time,
|
|
35
|
+
select_date: input.date,
|
|
36
|
+
duration: 0,
|
|
37
|
+
is_all: 0,
|
|
38
|
+
sub_type: 'minutes',
|
|
39
|
+
like_status: booking.like_status || 'common',
|
|
40
|
+
resources: [],
|
|
41
|
+
metadata: {
|
|
42
|
+
...metadata,
|
|
43
|
+
unique_identification_number: String(metadata.unique_identification_number || (0, _orderCollectionIdentity.createUuidV4)()),
|
|
44
|
+
is_fulfillment_timing: true,
|
|
45
|
+
fulfillment_timing: {
|
|
46
|
+
method: 'pick_up',
|
|
47
|
+
mode: input.mode,
|
|
48
|
+
source: input.source,
|
|
49
|
+
...(input.instant !== undefined ? {
|
|
50
|
+
instant: input.instant
|
|
51
|
+
} : {}),
|
|
52
|
+
...(input.timezone !== undefined ? {
|
|
53
|
+
timezone: input.timezone
|
|
54
|
+
} : {}),
|
|
55
|
+
...(input.frozen !== undefined ? {
|
|
56
|
+
frozen: input.frozen
|
|
57
|
+
} : {})
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -7,9 +7,10 @@ import type { SubmitPayloadEnhancer } from './utils';
|
|
|
7
7
|
import type { PaymentItem } from '../Payment/types';
|
|
8
8
|
import type { ICustomer } from '../AccountList/types';
|
|
9
9
|
import type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
10
|
+
import type { PickupTimingBooking, PickupTimingBookingInput } from './pickupTiming';
|
|
10
11
|
export type { OrderProductDiscountItem } from '../../server/modules/order/types';
|
|
11
12
|
export type PickupReferenceMode = 'counter_pickup' | 'table_service';
|
|
12
|
-
export type ShopServiceType = 'dine_in' | 'takeaway';
|
|
13
|
+
export type ShopServiceType = 'dine_in' | 'takeaway' | 'pick_up' | 'delivery';
|
|
13
14
|
export interface ShopServiceData {
|
|
14
15
|
pickup_reference_mode?: PickupReferenceMode;
|
|
15
16
|
service_type?: ShopServiceType | '';
|
|
@@ -863,6 +864,9 @@ export interface OrderModuleAPI {
|
|
|
863
864
|
updateTempOrderCustomer: (customer: UpdateTempOrderCustomerInput) => OrderSnapshot['customer'];
|
|
864
865
|
updateTempOrderPickupReferenceMode: (mode: PickupReferenceMode) => ShopServiceData;
|
|
865
866
|
updateTempOrderServiceType: (serviceType: ShopServiceType) => ShopServiceData;
|
|
867
|
+
getPickupTimingBooking: () => PickupTimingBooking | null;
|
|
868
|
+
setPickupTimingBooking: (input: PickupTimingBookingInput) => PickupTimingBooking;
|
|
869
|
+
clearPickupTimingBooking: () => void;
|
|
866
870
|
updateTempOrderBuzzer: (buzzer: string) => string;
|
|
867
871
|
updateTempOrderContactsInfo: (contactsInfo: Record<string, any> | null) => Record<string, any> | null;
|
|
868
872
|
addProductToOrder: (product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions) => Promise<OrderProduct[]>;
|
|
@@ -137,6 +137,7 @@ var _utils = require("../Holder/utils");
|
|
|
137
137
|
var _utils2 = require("../../solution/ScanOrder/utils");
|
|
138
138
|
var _orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
139
139
|
var _salesNotes = require("./salesNotes");
|
|
140
|
+
var _pickupTiming = require("./pickupTiming");
|
|
140
141
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
141
142
|
_dayjs.default.extend(_customParseFormat.default);
|
|
142
143
|
const POINT_CARD_SNAPSHOT_TAG = 'point_card';
|
|
@@ -1299,7 +1300,7 @@ function normalizeSubmitProduct(product, formatOptions = {}) {
|
|
|
1299
1300
|
payment_price: formatOptions.virtualSettlementMode ? virtualPrice : submitProduct.payment_price ?? submitProduct.selling_price
|
|
1300
1301
|
};
|
|
1301
1302
|
}
|
|
1302
|
-
const SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder'];
|
|
1303
|
+
const SUBMIT_BOOKING_METADATA_WHITELIST = ['unique_identification_number', 'collect_pax', 'capacity', 'holder_id', 'resource_select_type', 'holder', 'is_fulfillment_timing', 'fulfillment_timing'];
|
|
1303
1304
|
function normalizeBookingIsAll(booking) {
|
|
1304
1305
|
return booking.is_all === true || booking.is_all === 1 || booking.is_all === '1' || booking.is_all === 'true' ? 1 : 0;
|
|
1305
1306
|
}
|
|
@@ -1318,7 +1319,9 @@ function normalizeSubmitBooking(booking) {
|
|
|
1318
1319
|
cleanMetadata[key] = rawMetadata[key];
|
|
1319
1320
|
}
|
|
1320
1321
|
}
|
|
1321
|
-
if (cleanMetadata.holder_id === undefined
|
|
1322
|
+
if (cleanMetadata.holder_id === undefined && !(0, _pickupTiming.isFulfillmentTimingBooking)(booking)) {
|
|
1323
|
+
cleanMetadata.holder_id = null;
|
|
1324
|
+
}
|
|
1322
1325
|
const bookingRecord = booking;
|
|
1323
1326
|
const startDate = bookingRecord.start_date;
|
|
1324
1327
|
const shouldRestoreSelectDate = bookingRecord.select_date === undefined || bookingRecord.select_date === null || bookingRecord.select_date === '';
|
|
@@ -1330,6 +1333,10 @@ function normalizeSubmitBooking(booking) {
|
|
|
1330
1333
|
} : {}),
|
|
1331
1334
|
is_all: normalizeBookingIsAll(bookingRecord),
|
|
1332
1335
|
sub_type: normalizeBookingSubType(bookingRecord),
|
|
1336
|
+
...((0, _pickupTiming.isFulfillmentTimingBooking)(booking) ? {
|
|
1337
|
+
like_status: bookingRecord.like_status || 'common',
|
|
1338
|
+
schedule_id: bookingRecord.schedule_id || 0
|
|
1339
|
+
} : {}),
|
|
1333
1340
|
metadata: cleanMetadata
|
|
1334
1341
|
};
|
|
1335
1342
|
}
|
|
@@ -1415,6 +1422,7 @@ function hasBoundBookingResource(bookings) {
|
|
|
1415
1422
|
if (!Array.isArray(bookings)) return false;
|
|
1416
1423
|
return bookings.some(booking => {
|
|
1417
1424
|
if (!booking || typeof booking !== 'object') return false;
|
|
1425
|
+
if ((0, _pickupTiming.isFulfillmentTimingBooking)(booking)) return false;
|
|
1418
1426
|
if (Number(booking.parent_id) === 0) return false;
|
|
1419
1427
|
const resources = booking.resources;
|
|
1420
1428
|
if (!Array.isArray(resources)) return false;
|
|
@@ -1450,7 +1458,7 @@ function resolveSubmitOrderType(params) {
|
|
|
1450
1458
|
return 'table-order';
|
|
1451
1459
|
}
|
|
1452
1460
|
if (currentType) return currentType;
|
|
1453
|
-
if (Array.isArray(bookings) && bookings.
|
|
1461
|
+
if (Array.isArray(bookings) && bookings.some(booking => !(0, _pickupTiming.isFulfillmentTimingBooking)(booking))) {
|
|
1454
1462
|
return businessCode === 'dine_in' ? 'table-order' : 'appointment_booking';
|
|
1455
1463
|
}
|
|
1456
1464
|
return 'virtual';
|
|
@@ -1535,7 +1543,7 @@ function buildSubmitPayload(params) {
|
|
|
1535
1543
|
delivery_type: tempOrder.delivery_type || 'nil',
|
|
1536
1544
|
schedule_date: scheduleDate,
|
|
1537
1545
|
// created_at: tempOrder.created_at || formatDateTime(now), 和后端协定这个字段先不提交到接口
|
|
1538
|
-
bookings: (tempOrder.bookings || []).filter(booking => Number(booking.parent_id) !== 0).map(booking => normalizeSubmitBooking(booking)),
|
|
1546
|
+
bookings: (tempOrder.bookings || []).filter(booking => (0, _pickupTiming.isFulfillmentTimingBooking)(booking) || Number(booking.parent_id) !== 0).map(booking => normalizeSubmitBooking(booking)),
|
|
1539
1547
|
payments: tempOrder.payments || [],
|
|
1540
1548
|
relation_forms: tempOrder.relation_forms || [],
|
|
1541
1549
|
// contacts: tempOrder.contacts || [],
|
|
@@ -9,6 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
};
|
|
10
10
|
exports.PaymentModule = void 0;
|
|
11
11
|
exports.generateRequestUniqueId = generateRequestUniqueId;
|
|
12
|
+
var _loadPaymentMethods = require("../../shared/payment/loadPaymentMethods");
|
|
12
13
|
var _BaseModule = require("../BaseModule");
|
|
13
14
|
var _types = require("./types");
|
|
14
15
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -282,12 +283,10 @@ class PaymentModule extends _BaseModule.BaseModule {
|
|
|
282
283
|
async getPayMethodListAsync() {
|
|
283
284
|
this.logInfo('Starting getPayMethodListAsync');
|
|
284
285
|
try {
|
|
285
|
-
const
|
|
286
|
+
const payMethods = await (0, _loadPaymentMethods.loadPaymentMethods)(this.request, {
|
|
287
|
+
transport: 'os-server',
|
|
286
288
|
filterPaymentMethods: true
|
|
287
|
-
}, {
|
|
288
|
-
osServer: true
|
|
289
289
|
});
|
|
290
|
-
const payMethods = response?.data || response || [];
|
|
291
290
|
this.logInfo('getPayMethodListAsync completed successfully', {
|
|
292
291
|
payMethods
|
|
293
292
|
});
|
|
@@ -10,6 +10,10 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
10
10
|
private openCache;
|
|
11
11
|
private fatherModule;
|
|
12
12
|
private hasLoadedScheduleList;
|
|
13
|
+
private scheduleListPromise;
|
|
14
|
+
private scheduleListRequestVersion;
|
|
15
|
+
private scheduleCatalogScope;
|
|
16
|
+
private otherParams;
|
|
13
17
|
constructor(name?: string, version?: string);
|
|
14
18
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
15
19
|
/**
|
|
@@ -19,6 +23,9 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
19
23
|
* scheduleModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' });
|
|
20
24
|
*/
|
|
21
25
|
updateOtherParams(params: Record<string, any>): void;
|
|
26
|
+
private syncScheduleCatalogScope;
|
|
27
|
+
private resetScheduleCatalog;
|
|
28
|
+
destroy(): void;
|
|
22
29
|
/**
|
|
23
30
|
* 加载当前店铺下所有 schedule
|
|
24
31
|
*
|
|
@@ -27,6 +34,7 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
27
34
|
loadAllSchedule(options?: {
|
|
28
35
|
useCache?: boolean;
|
|
29
36
|
}): Promise<void>;
|
|
37
|
+
private loadScheduleCatalog;
|
|
30
38
|
setScheduleList(list: ScheduleItem[]): void;
|
|
31
39
|
private syncScheduleMap;
|
|
32
40
|
getScheduleList(): ScheduleItem[];
|
|
@@ -24,10 +24,18 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
24
24
|
openCache = false;
|
|
25
25
|
fatherModule;
|
|
26
26
|
hasLoadedScheduleList = false;
|
|
27
|
+
scheduleListPromise = null;
|
|
28
|
+
scheduleListRequestVersion = 0;
|
|
29
|
+
scheduleCatalogScope = '';
|
|
30
|
+
otherParams = {};
|
|
27
31
|
constructor(name, version) {
|
|
28
32
|
super(name, version);
|
|
29
33
|
}
|
|
30
34
|
async initialize(core, options) {
|
|
35
|
+
// The store proxies initialState, so capture its input before resets write through it.
|
|
36
|
+
const initialScheduleList = options.initialState?.scheduleList;
|
|
37
|
+
const hasInitialScheduleList = Array.isArray(initialScheduleList);
|
|
38
|
+
this.resetScheduleCatalog();
|
|
31
39
|
this.core = core;
|
|
32
40
|
|
|
33
41
|
// 获取依赖的插件
|
|
@@ -40,24 +48,18 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
40
48
|
// this.state = { ...this.state, ...options.initialState }
|
|
41
49
|
// }
|
|
42
50
|
this.store = options?.store;
|
|
51
|
+
this.updateOtherParams(options.otherParams || {});
|
|
43
52
|
if (options.initialState) {
|
|
44
|
-
this.store.scheduleList =
|
|
53
|
+
this.store.scheduleList = hasInitialScheduleList ? initialScheduleList : [];
|
|
45
54
|
this.syncScheduleMap();
|
|
46
55
|
this.store.availabilityDateList = options.initialState.availabilityDateList;
|
|
47
|
-
this.hasLoadedScheduleList =
|
|
56
|
+
this.hasLoadedScheduleList = hasInitialScheduleList;
|
|
48
57
|
} else {
|
|
49
58
|
this.store.scheduleList = [];
|
|
50
59
|
this.store.map = new Map();
|
|
51
60
|
this.store.availabilityDateList = [];
|
|
52
61
|
this.hasLoadedScheduleList = false;
|
|
53
62
|
}
|
|
54
|
-
if (options.otherParams?.cacheId) {
|
|
55
|
-
this.openCache = options.otherParams.openCache;
|
|
56
|
-
this.cacheId = options.otherParams.cacheId;
|
|
57
|
-
}
|
|
58
|
-
if (options.otherParams?.fatherModule) {
|
|
59
|
-
this.fatherModule = options.otherParams.fatherModule;
|
|
60
|
-
}
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
/**
|
|
@@ -68,9 +70,34 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
68
70
|
*/
|
|
69
71
|
updateOtherParams(params) {
|
|
70
72
|
const otherParams = params || {};
|
|
73
|
+
this.otherParams = {
|
|
74
|
+
...otherParams
|
|
75
|
+
};
|
|
71
76
|
this.openCache = otherParams.openCache ?? false;
|
|
72
77
|
this.cacheId = otherParams.cacheId;
|
|
73
78
|
this.fatherModule = otherParams.fatherModule;
|
|
79
|
+
this.syncScheduleCatalogScope();
|
|
80
|
+
}
|
|
81
|
+
syncScheduleCatalogScope() {
|
|
82
|
+
const context = this.core?.context;
|
|
83
|
+
const shopId = typeof context?.getData === 'function' ? context.getData('shop_id') : context?.shop_id;
|
|
84
|
+
const params = this.otherParams;
|
|
85
|
+
const scope = JSON.stringify([this.cacheId, this.fatherModule, params.businessCode ?? params.business_code, params.channel, params.platform, params.businessTimezone, shopId].map(value => String(value ?? '').trim()));
|
|
86
|
+
if (scope !== this.scheduleCatalogScope) {
|
|
87
|
+
this.resetScheduleCatalog();
|
|
88
|
+
this.scheduleCatalogScope = scope;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
resetScheduleCatalog() {
|
|
92
|
+
this.scheduleListRequestVersion += 1;
|
|
93
|
+
this.scheduleListPromise = null;
|
|
94
|
+
this.hasLoadedScheduleList = false;
|
|
95
|
+
this.store.scheduleList = [];
|
|
96
|
+
this.store.map = new Map();
|
|
97
|
+
}
|
|
98
|
+
destroy() {
|
|
99
|
+
this.resetScheduleCatalog();
|
|
100
|
+
super.destroy();
|
|
74
101
|
}
|
|
75
102
|
|
|
76
103
|
/**
|
|
@@ -79,14 +106,40 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
79
106
|
* @memberof ScheduleModule
|
|
80
107
|
*/
|
|
81
108
|
async loadAllSchedule(options = {}) {
|
|
82
|
-
|
|
109
|
+
this.syncScheduleCatalogScope();
|
|
110
|
+
const useCache = options.useCache ?? true;
|
|
111
|
+
if (useCache) {
|
|
112
|
+
if (this.scheduleListPromise) return this.scheduleListPromise;
|
|
113
|
+
if (this.hasLoadedScheduleList) return;
|
|
114
|
+
}
|
|
115
|
+
const requestVersion = ++this.scheduleListRequestVersion;
|
|
116
|
+
const promise = this.loadScheduleCatalog(useCache, requestVersion);
|
|
117
|
+
this.scheduleListPromise = promise;
|
|
118
|
+
try {
|
|
119
|
+
await promise;
|
|
120
|
+
} finally {
|
|
121
|
+
if (this.scheduleListPromise === promise) {
|
|
122
|
+
this.scheduleListPromise = null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async loadScheduleCatalog(useCache, requestVersion) {
|
|
127
|
+
const response = await this.request.get(`/schedule`, {
|
|
83
128
|
num: 999
|
|
84
129
|
}, {
|
|
85
|
-
useCache
|
|
130
|
+
useCache
|
|
86
131
|
});
|
|
87
|
-
|
|
132
|
+
if (response.code !== undefined && Number(response.code) !== 200 || response.status === false || typeof response.status === 'number' && response.status >= 400 || response.success === false) {
|
|
133
|
+
throw new Error(response.message || 'Schedule catalog request failed');
|
|
134
|
+
}
|
|
135
|
+
this.syncScheduleCatalogScope();
|
|
136
|
+
// A refresh or a different runtime may have superseded this request.
|
|
137
|
+
if (requestVersion === this.scheduleListRequestVersion) {
|
|
138
|
+
this.setScheduleList(response.data?.list || []);
|
|
139
|
+
}
|
|
88
140
|
}
|
|
89
141
|
setScheduleList(list) {
|
|
142
|
+
this.syncScheduleCatalogScope();
|
|
90
143
|
this.store.scheduleList = list;
|
|
91
144
|
this.syncScheduleMap();
|
|
92
145
|
this.hasLoadedScheduleList = true;
|
|
@@ -95,9 +148,11 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
95
148
|
this.store.map = new Map((this.store.scheduleList || []).map(schedule => [Number(schedule.id), schedule]));
|
|
96
149
|
}
|
|
97
150
|
getScheduleList() {
|
|
151
|
+
this.syncScheduleCatalogScope();
|
|
98
152
|
return this.store.scheduleList || [];
|
|
99
153
|
}
|
|
100
154
|
isScheduleListLoaded() {
|
|
155
|
+
this.syncScheduleCatalogScope();
|
|
101
156
|
return this.hasLoadedScheduleList;
|
|
102
157
|
}
|
|
103
158
|
async loadScheduleAvailableDate({
|
|
@@ -149,6 +204,7 @@ class ScheduleModule extends _BaseModule.BaseModule {
|
|
|
149
204
|
return dates;
|
|
150
205
|
}
|
|
151
206
|
getScheduleListByIds(ids) {
|
|
207
|
+
this.syncScheduleCatalogScope();
|
|
152
208
|
const idSet = new Set(ids.map(id => String(id)));
|
|
153
209
|
if (this.store.map instanceof Map && this.store.map.size > 0) {
|
|
154
210
|
return ids.map(id => this.store.map.get(Number(id))).filter(Boolean);
|
package/lib/modules/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './Schedule';
|
|
|
17
17
|
export * from './Quotation';
|
|
18
18
|
export * from './ScanOrderLogger';
|
|
19
19
|
export * from './OpenData';
|
|
20
|
+
export * from './FulfillmentTiming';
|
|
20
21
|
export * from './BookingContext';
|
|
21
22
|
export * from './Holder';
|
|
22
23
|
export * from './ResourcePlanner';
|
package/lib/modules/index.js
CHANGED
|
@@ -212,6 +212,17 @@ Object.keys(_OpenData).forEach(function (key) {
|
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
});
|
|
215
|
+
var _FulfillmentTiming = require("./FulfillmentTiming");
|
|
216
|
+
Object.keys(_FulfillmentTiming).forEach(function (key) {
|
|
217
|
+
if (key === "default" || key === "__esModule") return;
|
|
218
|
+
if (key in exports && exports[key] === _FulfillmentTiming[key]) return;
|
|
219
|
+
Object.defineProperty(exports, key, {
|
|
220
|
+
enumerable: true,
|
|
221
|
+
get: function () {
|
|
222
|
+
return _FulfillmentTiming[key];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
});
|
|
215
226
|
var _BookingContext = require("./BookingContext");
|
|
216
227
|
Object.keys(_BookingContext).forEach(function (key) {
|
|
217
228
|
if (key === "default" || key === "__esModule") return;
|
package/lib/plugins/request.d.ts
CHANGED
|
@@ -56,6 +56,13 @@ export interface CacheProps {
|
|
|
56
56
|
* 请求配置
|
|
57
57
|
*/
|
|
58
58
|
export interface RequestOptions {
|
|
59
|
+
/** Customer-only, credential-free GET /open/document/{id} on picoding. */
|
|
60
|
+
publicInvoiceDocument?: boolean;
|
|
61
|
+
/** Route through the host's configured picoding environment. */
|
|
62
|
+
pisell2?: boolean;
|
|
63
|
+
/** Let the caller handle read-only preview failures without host navigation/toasts. */
|
|
64
|
+
manualErrorHandling?: boolean;
|
|
65
|
+
skipErrorHandler?: boolean;
|
|
59
66
|
url?: string;
|
|
60
67
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
61
68
|
headers?: Record<string, string>;
|
|
@@ -1,85 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
name?: string;
|
|
3
|
-
phone?: string;
|
|
4
|
-
address?: string;
|
|
5
|
-
address_street?: string;
|
|
6
|
-
address_detail?: string;
|
|
7
|
-
city?: string;
|
|
8
|
-
province?: string;
|
|
9
|
-
country?: string;
|
|
10
|
-
zip?: string;
|
|
11
|
-
tax_number?: string;
|
|
12
|
-
tax_title?: string;
|
|
13
|
-
is_price_include_tax?: 0 | 1 | boolean;
|
|
14
|
-
currency_symbol?: string;
|
|
15
|
-
currency_code?: string;
|
|
16
|
-
primary_locale?: string;
|
|
17
|
-
timezone?: string;
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
}
|
|
20
|
-
export interface BuildSmallTicketDataParams {
|
|
21
|
-
order: Record<string, any>;
|
|
22
|
-
shopInfo?: SmallTicketShopInfo | null;
|
|
23
|
-
locales?: string[];
|
|
24
|
-
productMap?: Record<string | number, Record<string, any>>;
|
|
25
|
-
}
|
|
26
|
-
export interface SmallTicketItem {
|
|
27
|
-
item: string;
|
|
28
|
-
value: string;
|
|
29
|
-
size?: number;
|
|
30
|
-
align?: string;
|
|
31
|
-
product_uid?: string | number;
|
|
32
|
-
booking_uid?: string | number;
|
|
33
|
-
}
|
|
34
|
-
export interface SmallTicketProduct {
|
|
35
|
-
product_title: string;
|
|
36
|
-
product_quantity: number;
|
|
37
|
-
selling_price: string;
|
|
38
|
-
total_selling_price: string;
|
|
39
|
-
original_price: string;
|
|
40
|
-
base_price?: string;
|
|
41
|
-
total_original_price: string;
|
|
42
|
-
options_total_price?: string;
|
|
43
|
-
package_items_total_price?: string;
|
|
44
|
-
extension_list: any[];
|
|
45
|
-
product_uid?: string | number;
|
|
46
|
-
booking_uid?: string | number;
|
|
47
|
-
product_note?: string;
|
|
48
|
-
allergy?: string;
|
|
49
|
-
options?: Array<{
|
|
50
|
-
name: string;
|
|
51
|
-
num?: number;
|
|
52
|
-
price?: string;
|
|
53
|
-
total_price: string;
|
|
54
|
-
value?: string;
|
|
55
|
-
}>;
|
|
56
|
-
variant?: string;
|
|
57
|
-
combinations?: any[];
|
|
58
|
-
}
|
|
59
|
-
export type SmallTicketAppointment = SmallTicketItem[];
|
|
60
|
-
export interface SmallTicketLocaleData {
|
|
61
|
-
base_data: Record<string, any>;
|
|
62
|
-
products: SmallTicketProduct[];
|
|
63
|
-
fees: {
|
|
64
|
-
fees: SmallTicketItem[];
|
|
65
|
-
countFee: Record<string, any>;
|
|
66
|
-
};
|
|
67
|
-
customer: SmallTicketItem[];
|
|
68
|
-
appointment: SmallTicketAppointment;
|
|
69
|
-
delivery?: SmallTicketItem[];
|
|
70
|
-
resources: Array<{
|
|
71
|
-
id: string | number;
|
|
72
|
-
code: string;
|
|
73
|
-
title: string;
|
|
74
|
-
form_title: string;
|
|
75
|
-
}>;
|
|
76
|
-
payment_data: SmallTicketItem[][];
|
|
77
|
-
wallets: SmallTicketItem[][];
|
|
78
|
-
tickets: any[];
|
|
79
|
-
source_shop: any[];
|
|
80
|
-
refund_data: SmallTicketItem[][];
|
|
81
|
-
expend_data: any[];
|
|
82
|
-
}
|
|
83
|
-
export type SmallTicketData = Record<string, SmallTicketLocaleData>;
|
|
84
|
-
export declare function buildSmallTicketData(params: BuildSmallTicketDataParams): SmallTicketData;
|
|
85
|
-
export declare function hasSmallTicketData(value: any): boolean;
|
|
1
|
+
export * from '../../shared/receipt/small-ticket';
|