@pisell/pisellos 2.2.163 → 2.2.165
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/BookingContext/index.d.ts +37 -0
- package/dist/modules/BookingContext/index.js +436 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +157 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +191 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Customer/index.js +23 -22
- package/dist/modules/Discount/index.js +4 -3
- package/dist/modules/Order/index.d.ts +25 -7
- package/dist/modules/Order/index.js +608 -291
- package/dist/modules/Order/types.d.ts +46 -14
- package/dist/modules/Order/types.js +2 -0
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +76 -23
- package/dist/modules/SalesSummary/index.js +4 -2
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +2 -1
- package/dist/solution/BaseSales/index.d.ts +46 -7
- package/dist/solution/BaseSales/index.js +928 -312
- package/dist/solution/BaseSales/types.d.ts +51 -1
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +159 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +33 -14
- package/dist/solution/BaseSales/utils.js +36 -7
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +124 -1
- package/dist/solution/BookingTicket/index.js +488 -90
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/BookingTicket/types.js +3 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +334 -0
- package/dist/solution/ScanOrder/index.d.ts +9 -3
- package/dist/solution/ScanOrder/index.js +231 -128
- package/dist/solution/ScanOrder/utils.js +36 -7
- package/dist/solution/VenueBooking/index.d.ts +4 -2
- package/dist/solution/VenueBooking/index.js +103 -55
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/lib/modules/BookingContext/index.d.ts +37 -0
- package/lib/modules/BookingContext/index.js +297 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +174 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +177 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Customer/index.js +8 -8
- package/lib/modules/Discount/index.js +5 -1
- package/lib/modules/Order/index.d.ts +25 -7
- package/lib/modules/Order/index.js +268 -72
- package/lib/modules/Order/types.d.ts +46 -14
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +66 -15
- package/lib/modules/SalesSummary/index.js +4 -2
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +3 -1
- package/lib/solution/BaseSales/index.d.ts +46 -7
- package/lib/solution/BaseSales/index.js +369 -17
- package/lib/solution/BaseSales/types.d.ts +51 -1
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +201 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +31 -10
- package/lib/solution/BaseSales/utils.js +37 -5
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +124 -1
- package/lib/solution/BookingTicket/index.js +255 -8
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/BookingTicket/types.js +6 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +308 -0
- package/lib/solution/ScanOrder/index.d.ts +9 -3
- package/lib/solution/ScanOrder/index.js +147 -66
- package/lib/solution/ScanOrder/utils.js +37 -5
- package/lib/solution/VenueBooking/index.d.ts +4 -2
- package/lib/solution/VenueBooking/index.js +50 -14
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { getDurationValue } from './flexible';
|
|
3
|
+
export interface TimeSlice {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DurationSlice {
|
|
8
|
+
label: string;
|
|
9
|
+
value: number;
|
|
10
|
+
}
|
|
11
|
+
export interface TimeSlicesResult {
|
|
12
|
+
timeSlices: TimeSlice[];
|
|
13
|
+
durationSlicesBasedOnTime: DurationSlice[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 把一天切成等长时间槽,输出 timeSlices(开始时间标签)与 durationSlicesBasedOnTime(基于切片的时长选项)。
|
|
17
|
+
*
|
|
18
|
+
* 与 info2 `sliceDayIntoFiveMinutes` 行为等价;为了不依赖 `locales`,label 输出原始时间字符串('08:00 AM' / '90'),
|
|
19
|
+
* UI 侧需要本地化展示时可基于 value 自行包装。
|
|
20
|
+
*
|
|
21
|
+
* @param config booking config `basic.service_time`,{ value: minutes }
|
|
22
|
+
* @param isDay 是否跨日预约(true 时按 1~30 天切片)
|
|
23
|
+
*/
|
|
24
|
+
export declare function sliceDayIntoFiveMinutes(config: {
|
|
25
|
+
value?: number;
|
|
26
|
+
} | undefined | null, isDay?: boolean): TimeSlicesResult;
|
|
27
|
+
/**
|
|
28
|
+
* 取「下一个 duration 选项」:优先用 defaultValue;否则在 array 中找匹配的;找不到取第一个。
|
|
29
|
+
* 与 info2 `findNextDuration` 等价。
|
|
30
|
+
*/
|
|
31
|
+
export declare function findNextDuration(current: {
|
|
32
|
+
value?: number;
|
|
33
|
+
} | undefined, array: DurationSlice[], defaultValue?: number): number | undefined;
|
|
34
|
+
/** 取首选 time slice:若指定 date(HH:mm)则找第一个 >= date 的;否则第一个。 */
|
|
35
|
+
export declare function findNextSlice(params: {
|
|
36
|
+
timeSlices: TimeSlice[];
|
|
37
|
+
index?: number;
|
|
38
|
+
date?: string;
|
|
39
|
+
}): string | undefined;
|
|
40
|
+
/** 取 endDate;duration='flexible' 时取 endDate 与店铺营业时间的较小值,否则 startDate + duration 分钟。 */
|
|
41
|
+
export declare function getEndDate(startDate: dayjs.Dayjs, duration: string | number, endDate: any, shopOpeningHours?: string): dayjs.Dayjs;
|
|
42
|
+
export { getDurationValue };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/modules/BookingContext/utils/timeSlices.ts
|
|
30
|
+
var timeSlices_exports = {};
|
|
31
|
+
__export(timeSlices_exports, {
|
|
32
|
+
findNextDuration: () => findNextDuration,
|
|
33
|
+
findNextSlice: () => findNextSlice,
|
|
34
|
+
getDurationValue: () => import_flexible.getDurationValue,
|
|
35
|
+
getEndDate: () => getEndDate,
|
|
36
|
+
sliceDayIntoFiveMinutes: () => sliceDayIntoFiveMinutes
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(timeSlices_exports);
|
|
39
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
40
|
+
var import_flexible = require("./flexible");
|
|
41
|
+
function sliceDayIntoFiveMinutes(config, isDay) {
|
|
42
|
+
const startTime = (0, import_dayjs.default)().startOf("day");
|
|
43
|
+
const endTime = (0, import_dayjs.default)().endOf("day");
|
|
44
|
+
const timeSlice = config && config.value || 5;
|
|
45
|
+
const timeSlices = [];
|
|
46
|
+
const durationSlicesBasedOnTime = [];
|
|
47
|
+
let currentTime = startTime;
|
|
48
|
+
if (isDay) {
|
|
49
|
+
let currentDay = 1;
|
|
50
|
+
while (currentDay <= 30) {
|
|
51
|
+
timeSlices.push({
|
|
52
|
+
label: currentTime.format("hh:mm A"),
|
|
53
|
+
value: currentTime.format("HH:mm")
|
|
54
|
+
});
|
|
55
|
+
durationSlicesBasedOnTime.push({
|
|
56
|
+
label: String(currentDay),
|
|
57
|
+
value: currentDay
|
|
58
|
+
});
|
|
59
|
+
currentDay += 1;
|
|
60
|
+
}
|
|
61
|
+
return { timeSlices, durationSlicesBasedOnTime };
|
|
62
|
+
}
|
|
63
|
+
while (currentTime.isBefore(endTime)) {
|
|
64
|
+
timeSlices.push({
|
|
65
|
+
label: currentTime.format("hh:mm A"),
|
|
66
|
+
value: currentTime.format("HH:mm")
|
|
67
|
+
});
|
|
68
|
+
const nextTime = currentTime.add(timeSlice, "minute");
|
|
69
|
+
const durationValue = nextTime.diff(startTime, "minute");
|
|
70
|
+
durationSlicesBasedOnTime.push({
|
|
71
|
+
label: String(durationValue),
|
|
72
|
+
value: durationValue
|
|
73
|
+
});
|
|
74
|
+
currentTime = nextTime;
|
|
75
|
+
}
|
|
76
|
+
return { timeSlices, durationSlicesBasedOnTime };
|
|
77
|
+
}
|
|
78
|
+
function findNextDuration(current, array, defaultValue) {
|
|
79
|
+
if (defaultValue !== void 0 && defaultValue !== null)
|
|
80
|
+
return defaultValue;
|
|
81
|
+
if (!array || array.length === 0)
|
|
82
|
+
return void 0;
|
|
83
|
+
for (let i = 0; i < array.length; i += 1) {
|
|
84
|
+
if (array[i].value === (current == null ? void 0 : current.value))
|
|
85
|
+
return array[i].value;
|
|
86
|
+
}
|
|
87
|
+
return array[0].value;
|
|
88
|
+
}
|
|
89
|
+
function findNextSlice(params) {
|
|
90
|
+
var _a;
|
|
91
|
+
const { timeSlices, index = 0, date = "" } = params;
|
|
92
|
+
const currentTimeValue = date || (0, import_dayjs.default)().format("HH:mm");
|
|
93
|
+
for (let i = 0; i < timeSlices.length; i += 1) {
|
|
94
|
+
if (timeSlices[i].value !== "now" && timeSlices[i].value >= currentTimeValue) {
|
|
95
|
+
return timeSlices[i].value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return (_a = timeSlices[index]) == null ? void 0 : _a.value;
|
|
99
|
+
}
|
|
100
|
+
function getEndDate(startDate, duration, endDate, shopOpeningHours) {
|
|
101
|
+
if (duration === "flexible") {
|
|
102
|
+
let openingDate = (0, import_dayjs.default)(
|
|
103
|
+
`${startDate.format("YYYY-MM-DD")} ${shopOpeningHours || "23:59"}`
|
|
104
|
+
);
|
|
105
|
+
if ((0, import_dayjs.default)(startDate).isAfter(openingDate)) {
|
|
106
|
+
openingDate = openingDate.add(1, "day");
|
|
107
|
+
}
|
|
108
|
+
if (!endDate)
|
|
109
|
+
return openingDate;
|
|
110
|
+
const endDateObj = (0, import_dayjs.default)(endDate);
|
|
111
|
+
if (endDateObj.isAfter(openingDate))
|
|
112
|
+
return openingDate;
|
|
113
|
+
return endDateObj;
|
|
114
|
+
}
|
|
115
|
+
return startDate.add(Number(duration), "minute");
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
findNextDuration,
|
|
120
|
+
findNextSlice,
|
|
121
|
+
getDurationValue,
|
|
122
|
+
getEndDate,
|
|
123
|
+
sliceDayIntoFiveMinutes
|
|
124
|
+
});
|
|
@@ -169,10 +169,6 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
169
169
|
this.store.total = total;
|
|
170
170
|
this.store.hasMore = page * pageSize < total;
|
|
171
171
|
this.store.customerList = (0, import_lodash_es.cloneDeep)(customerList);
|
|
172
|
-
await this.core.effects.emit(
|
|
173
|
-
`${this.name}:onCustomerListUpdate`,
|
|
174
|
-
this.store
|
|
175
|
-
);
|
|
176
172
|
this.triggerPaginationChange({
|
|
177
173
|
page,
|
|
178
174
|
pageSize,
|
|
@@ -192,6 +188,10 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
192
188
|
} finally {
|
|
193
189
|
this.store.loading = false;
|
|
194
190
|
this.storeChange();
|
|
191
|
+
await this.core.effects.emit(
|
|
192
|
+
`${this.name}:onCustomerListUpdate`,
|
|
193
|
+
this.store
|
|
194
|
+
);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
@@ -372,10 +372,6 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
372
372
|
hasMore: this.store.hasMore
|
|
373
373
|
}
|
|
374
374
|
);
|
|
375
|
-
await this.core.effects.emit(
|
|
376
|
-
`${this.name}:onCustomerListUpdate`,
|
|
377
|
-
this.store
|
|
378
|
-
);
|
|
379
375
|
this.triggerPaginationChange({
|
|
380
376
|
page,
|
|
381
377
|
pageSize,
|
|
@@ -396,6 +392,10 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
396
392
|
} finally {
|
|
397
393
|
this.store.loadingMore = false;
|
|
398
394
|
this.storeChange();
|
|
395
|
+
await this.core.effects.emit(
|
|
396
|
+
`${this.name}:onCustomerListUpdate`,
|
|
397
|
+
this.store
|
|
398
|
+
);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
/**
|
|
@@ -97,8 +97,12 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
97
97
|
`/order/prepare/config`,
|
|
98
98
|
params
|
|
99
99
|
);
|
|
100
|
+
const rawDiscountList = [
|
|
101
|
+
...((_a = prepareConfig == null ? void 0 : prepareConfig.data) == null ? void 0 : _a.good_pass_list) || [],
|
|
102
|
+
...((_b = prepareConfig == null ? void 0 : prepareConfig.data) == null ? void 0 : _b.discount_card_list) || []
|
|
103
|
+
];
|
|
100
104
|
const goodPassList = this.filterEnabledDiscountList(
|
|
101
|
-
|
|
105
|
+
rawDiscountList
|
|
102
106
|
) || [];
|
|
103
107
|
return goodPassList;
|
|
104
108
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { OrderModuleAPI, CommitOrderParams,
|
|
3
|
+
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CheckoutOrderParams, CancelOrderParams, ChangeBookingStatusParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView } from './types';
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -43,8 +43,10 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
43
43
|
private createDefaultRulesHooks;
|
|
44
44
|
loadDiscountConfig(params: {
|
|
45
45
|
customerId: number;
|
|
46
|
-
action?: 'create';
|
|
47
|
-
|
|
46
|
+
action?: 'create' | 'edit';
|
|
47
|
+
orderId?: number;
|
|
48
|
+
apply?: boolean;
|
|
49
|
+
}): Promise<Discount[]>;
|
|
48
50
|
getDiscountList(): Discount[];
|
|
49
51
|
scanCode(code: string, customerId?: number): Promise<{
|
|
50
52
|
isAvailable: boolean;
|
|
@@ -70,6 +72,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
70
72
|
getLocalOrderByOrderNumber(orderNumber: string): Promise<Record<string, any> | null>;
|
|
71
73
|
getLocalOrderByExternalSaleNumber(externalSaleNumber: string): Promise<Record<string, any> | null>;
|
|
72
74
|
saveDraft(): Promise<void>;
|
|
75
|
+
private saveDraftInBackground;
|
|
73
76
|
private hydrateTempOrderFromLocalRecord;
|
|
74
77
|
private extractOrderIdFromSubmitResult;
|
|
75
78
|
private calculatePaymentTotal;
|
|
@@ -79,6 +82,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
79
82
|
ensureTempOrder(): OrderTempOrder;
|
|
80
83
|
restoreOrder(): OrderTempOrder;
|
|
81
84
|
getTempOrder(): OrderTempOrder | null;
|
|
85
|
+
replaceTempOrder(tempOrder: OrderTempOrder, options?: ReplaceTempOrderOptions): Promise<OrderTempOrder>;
|
|
82
86
|
getOrderIdentity(): OrderIdentitySnapshot | null;
|
|
83
87
|
getOrderSyncState(): OrderSyncState;
|
|
84
88
|
getOrderAmountSnapshot(): OrderAmountSnapshot | null;
|
|
@@ -89,12 +93,18 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
89
93
|
private ensureExtend;
|
|
90
94
|
private captureProductRuntime;
|
|
91
95
|
private createLinkedProductAndBooking;
|
|
96
|
+
private getBookingUniqueIdentificationNumber;
|
|
97
|
+
private findBookingIndexByUniqueIdentificationNumber;
|
|
98
|
+
private removeLinkedBookingsForProduct;
|
|
92
99
|
private getSalesSummary;
|
|
93
100
|
recalculateSummary(options?: {
|
|
94
101
|
createIfMissing?: boolean;
|
|
95
102
|
}): Promise<OrderSummary | null>;
|
|
96
103
|
getOrderSummary(): Promise<OrderSummary>;
|
|
97
104
|
updateTempOrderNote(note: string): string;
|
|
105
|
+
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
106
|
+
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
107
|
+
syncTempOrderNoteToRemote(orderId: number | string, note: string): Promise<string>;
|
|
98
108
|
getTempOrderNote(): string;
|
|
99
109
|
updateTempOrderShopDiscount(amount: string | number): string;
|
|
100
110
|
updateTempOrderBuzzer(buzzer: string): string;
|
|
@@ -147,8 +157,15 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
147
157
|
private shouldMergeProductToOrder;
|
|
148
158
|
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
|
|
149
159
|
private hasGoodPassDiscount;
|
|
150
|
-
|
|
160
|
+
updateOrderProduct(params: UpdateOrderProductParams): Promise<OrderProduct[]>;
|
|
161
|
+
updateOrderProductQuantity(params: UpdateOrderProductQuantityParams): Promise<OrderProduct[]>;
|
|
162
|
+
updateOrderBooking(params: UpdateOrderBookingParams): any[];
|
|
151
163
|
removeProductFromOrder(identity: OrderProductIdentity): Promise<OrderProduct[]>;
|
|
164
|
+
/**
|
|
165
|
+
* 仅清空购物车行(products / bookings / discount_list),不重置整单。
|
|
166
|
+
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
167
|
+
*/
|
|
168
|
+
clearOrderCartLines(): Promise<OrderTempOrder>;
|
|
152
169
|
/**
|
|
153
170
|
* 提交当前 Sales tempOrder。
|
|
154
171
|
*
|
|
@@ -173,7 +190,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
173
190
|
private logSubmitBackendRejected;
|
|
174
191
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
175
192
|
createOrder(params: CommitOrderParams['query']): {
|
|
176
|
-
type: "
|
|
193
|
+
type: "appointment_booking" | "virtual";
|
|
177
194
|
platform: string;
|
|
178
195
|
sales_channel: string;
|
|
179
196
|
order_sales_channel: string;
|
|
@@ -220,8 +237,9 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
220
237
|
hydrateTempOrderFromRecord(record: Record<string, any>, options?: {
|
|
221
238
|
recalcOnHydrate?: boolean;
|
|
222
239
|
}): Promise<OrderTempOrder>;
|
|
240
|
+
private normalizeTempOrderForRuntime;
|
|
223
241
|
private normalizeHydratedOrderProduct;
|
|
224
242
|
getLastOrderInfo(): Record<string, any> | undefined;
|
|
225
243
|
getOrderInfo(order_id: number): Promise<any>;
|
|
226
244
|
}
|
|
227
|
-
export type {
|
|
245
|
+
export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|