@pisell/pisellos 2.3.38 → 2.3.39
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/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +3 -7
- package/dist/solution/BookingTicket/index.js +49 -132
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1176 -860
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +3 -7
- package/lib/solution/BookingTicket/index.js +9 -62
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -123
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -77,10 +77,15 @@ function calculateResourceAvailableTime({
|
|
|
77
77
|
function findFastestAvailableResource({
|
|
78
78
|
resources,
|
|
79
79
|
currentCapacity = 1,
|
|
80
|
-
countMap = {}
|
|
80
|
+
countMap = {},
|
|
81
|
+
targetDate,
|
|
82
|
+
durationMinutes = 30
|
|
81
83
|
}) {
|
|
82
84
|
var _a, _b, _c;
|
|
83
85
|
const currentTime = (0, import_dayjs.default)();
|
|
86
|
+
const resolvedDuration = durationMinutes > 0 ? durationMinutes : 30;
|
|
87
|
+
const targetDay = targetDate ? (0, import_dayjs.default)(targetDate) : currentTime;
|
|
88
|
+
const isTargetDayToday = targetDay.isSame(currentTime, "day");
|
|
84
89
|
let fastestTime = null;
|
|
85
90
|
let fastestResources = [];
|
|
86
91
|
console.log("[TimeslotUtils] 查找最快可用资源:", {
|
|
@@ -90,19 +95,22 @@ function findFastestAvailableResource({
|
|
|
90
95
|
countMap
|
|
91
96
|
});
|
|
92
97
|
for (const resource of resources) {
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
const targetDayTimes = resource.times.filter((time) => {
|
|
99
|
+
const isSameTargetDay = (0, import_dayjs.default)(time.start_at).isSame(targetDay, "day");
|
|
100
|
+
if (!isSameTargetDay)
|
|
101
|
+
return false;
|
|
102
|
+
if (!isTargetDayToday)
|
|
103
|
+
return true;
|
|
104
|
+
return (0, import_dayjs.default)(time.end_at).isAfter(currentTime);
|
|
97
105
|
});
|
|
98
|
-
if (
|
|
106
|
+
if (targetDayTimes.length === 0) {
|
|
99
107
|
console.log(`[TimeslotUtils] 资源 ${resource.id}(${resource.main_field}) 今日无可用时间段`);
|
|
100
108
|
continue;
|
|
101
109
|
}
|
|
102
|
-
for (const time of
|
|
110
|
+
for (const time of targetDayTimes) {
|
|
103
111
|
const workStartTime = (0, import_dayjs.default)(time.start_at);
|
|
104
112
|
const workEndTime = (0, import_dayjs.default)(time.end_at);
|
|
105
|
-
let nextAvailableTime = currentTime.
|
|
113
|
+
let nextAvailableTime = isTargetDayToday && currentTime.isAfter(workStartTime) ? currentTime : workStartTime;
|
|
106
114
|
console.log(`[TimeslotUtils] 检查资源 ${resource.id}(${resource.main_field}):`, {
|
|
107
115
|
workTime: `${workStartTime.format("HH:mm")}-${workEndTime.format("HH:mm")}`,
|
|
108
116
|
checkStartTime: nextAvailableTime.format("HH:mm:ss"),
|
|
@@ -126,7 +134,7 @@ function findFastestAvailableResource({
|
|
|
126
134
|
pax: event.pax || 1
|
|
127
135
|
});
|
|
128
136
|
if (resource.resourceType === "single" || (resource.capacity || 1) === 1) {
|
|
129
|
-
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(
|
|
137
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
|
|
130
138
|
finalAvailableTime = eventEnd;
|
|
131
139
|
console.log(`[TimeslotUtils] 发现时间冲突,调整到: ${finalAvailableTime.format("HH:mm:ss")}`);
|
|
132
140
|
}
|
|
@@ -134,7 +142,7 @@ function findFastestAvailableResource({
|
|
|
134
142
|
const totalCapacity = resource.capacity || 0;
|
|
135
143
|
const currentUsedCapacity = countMap[resource.id] || 0;
|
|
136
144
|
const eventUsedCapacity = event.pax || 1;
|
|
137
|
-
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(
|
|
145
|
+
if (finalAvailableTime.isBefore(eventEnd) && eventStart.isBefore(finalAvailableTime.add(resolvedDuration, "minute"))) {
|
|
138
146
|
const totalRequiredCapacity = currentUsedCapacity + currentCapacity + eventUsedCapacity;
|
|
139
147
|
if (totalRequiredCapacity > totalCapacity) {
|
|
140
148
|
finalAvailableTime = eventEnd;
|
|
@@ -143,7 +151,7 @@ function findFastestAvailableResource({
|
|
|
143
151
|
}
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
|
-
if (finalAvailableTime.isAfter(workEndTime)) {
|
|
154
|
+
if (finalAvailableTime.add(resolvedDuration, "minute").isAfter(workEndTime)) {
|
|
147
155
|
console.log(`[TimeslotUtils] 资源 ${resource.id} 可用时间超出工作时间,跳过`);
|
|
148
156
|
continue;
|
|
149
157
|
}
|
|
@@ -46,8 +46,6 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
46
46
|
private getIdGeneratorPlugin;
|
|
47
47
|
private loadOpenDataConfig;
|
|
48
48
|
getOpenData(): Promise<OpenDataConfig | null>;
|
|
49
|
-
/** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
50
|
-
clearOpenDataCache(): void;
|
|
51
49
|
private getShortNumberOrDeviceId;
|
|
52
50
|
private configureIdGeneratorFromOpenData;
|
|
53
51
|
private normalizePositiveInteger;
|
|
@@ -191,12 +189,10 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
191
189
|
*/
|
|
192
190
|
getCustomer(): ICustomer | null;
|
|
193
191
|
/**
|
|
194
|
-
* 通过 ids
|
|
195
|
-
*
|
|
192
|
+
* 通过 ids 获取商品列表(不加载到模块中)
|
|
193
|
+
* @returns 商品列表
|
|
196
194
|
*/
|
|
197
|
-
getProductByIds(ids: number[]
|
|
198
|
-
loadMissing?: boolean;
|
|
199
|
-
}): Promise<ProductData[]>;
|
|
195
|
+
getProductByIds(ids: number[]): Promise<ProductData[] | undefined>;
|
|
200
196
|
/**
|
|
201
197
|
* 获取日程时间段点
|
|
202
198
|
* @param params 参数
|
|
@@ -219,14 +219,8 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
async getOpenData() {
|
|
222
|
-
return this.loadOpenDataConfig();
|
|
223
|
-
}
|
|
224
|
-
/** 清除店铺级 OpenData;下一次 getOpenData 时会重新拉取。 */
|
|
225
|
-
clearOpenDataCache() {
|
|
226
222
|
var _a;
|
|
227
|
-
this.
|
|
228
|
-
this.otherParams.openData = null;
|
|
229
|
-
(_a = this.store.openData) == null ? void 0 : _a.clearCache();
|
|
223
|
+
return (_a = this.store.openData) == null ? void 0 : _a.getOpenData();
|
|
230
224
|
}
|
|
231
225
|
async getShortNumberOrDeviceId() {
|
|
232
226
|
const getAsyncIotDeviceInfo = this.getAppData("async_iot_device_info");
|
|
@@ -239,7 +233,6 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
239
233
|
return String(this.getAppData("device_id") || 0).slice(-2);
|
|
240
234
|
}
|
|
241
235
|
async configureIdGeneratorFromOpenData() {
|
|
242
|
-
this.setPaymentNumberDevicePrefix(null);
|
|
243
236
|
let openDataConfig = null;
|
|
244
237
|
try {
|
|
245
238
|
openDataConfig = await this.loadOpenDataConfig();
|
|
@@ -271,7 +264,6 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
271
264
|
const resetReceiptSequenceDaily = typeof (openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"]) === "boolean" ? openDataConfig == null ? void 0 : openDataConfig["sale.short_number_daily_reset"] : false;
|
|
272
265
|
const operatingDayBoundary = this.getAppData("operating_day_boundary");
|
|
273
266
|
const deviceId = await this.getShortNumberOrDeviceId();
|
|
274
|
-
this.setPaymentNumberDevicePrefix(deviceId);
|
|
275
267
|
const businessCode = this.getBookingTicketBusinessCode();
|
|
276
268
|
if (!businessCode) {
|
|
277
269
|
console.warn("[BookingTicket] businessCode 缺失,跳过 idGenerator 配置");
|
|
@@ -722,53 +714,11 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
722
714
|
return this.getOrderCustomerSnapshot();
|
|
723
715
|
}
|
|
724
716
|
/**
|
|
725
|
-
* 通过 ids
|
|
726
|
-
*
|
|
717
|
+
* 通过 ids 获取商品列表(不加载到模块中)
|
|
718
|
+
* @returns 商品列表
|
|
727
719
|
*/
|
|
728
|
-
async getProductByIds(ids
|
|
729
|
-
|
|
730
|
-
const normalizedIds = Array.from(
|
|
731
|
-
new Set(
|
|
732
|
-
(ids || []).map((id) => Number(id)).filter((id) => Number.isFinite(id))
|
|
733
|
-
)
|
|
734
|
-
);
|
|
735
|
-
const localProducts = await this.store.products.getProductByIds(normalizedIds) || [];
|
|
736
|
-
if (!(options == null ? void 0 : options.loadMissing)) {
|
|
737
|
-
return localProducts;
|
|
738
|
-
}
|
|
739
|
-
const localProductIds = new Set(
|
|
740
|
-
localProducts.map((product) => Number(product.id))
|
|
741
|
-
);
|
|
742
|
-
const missingIds = normalizedIds.filter(
|
|
743
|
-
(id) => !localProductIds.has(id)
|
|
744
|
-
);
|
|
745
|
-
if (!missingIds.length) {
|
|
746
|
-
return localProducts;
|
|
747
|
-
}
|
|
748
|
-
const rawBookingDate = this.getBookingDate();
|
|
749
|
-
const bookingDate = rawBookingDate && (0, import_dayjs.default)(rawBookingDate).isValid() ? (0, import_dayjs.default)(rawBookingDate) : null;
|
|
750
|
-
const customerId = Number(
|
|
751
|
-
((_a = this.getOrderCustomerSnapshot()) == null ? void 0 : _a.id) ?? ((_b = this.getOrderCustomer()) == null ? void 0 : _b.customer_id)
|
|
752
|
-
);
|
|
753
|
-
const loadedProducts = await this.store.products.loadProducts({
|
|
754
|
-
product_ids: missingIds,
|
|
755
|
-
with_count: ["bundleGroup", "optionGroup"],
|
|
756
|
-
with_schedule: 1,
|
|
757
|
-
cacheId: this.cacheId,
|
|
758
|
-
...bookingDate ? {
|
|
759
|
-
schedule_date: bookingDate.format("YYYY-MM-DD"),
|
|
760
|
-
schedule_datetime: bookingDate.format("YYYY-MM-DD HH:mm:ss")
|
|
761
|
-
} : {},
|
|
762
|
-
...Number.isFinite(customerId) && customerId > 0 ? { customer_id: customerId } : {}
|
|
763
|
-
});
|
|
764
|
-
const productById = /* @__PURE__ */ new Map();
|
|
765
|
-
[...localProducts, ...loadedProducts || []].forEach((product) => {
|
|
766
|
-
const productId = Number(product.id);
|
|
767
|
-
if (Number.isFinite(productId)) {
|
|
768
|
-
productById.set(productId, product);
|
|
769
|
-
}
|
|
770
|
-
});
|
|
771
|
-
return normalizedIds.map((id) => productById.get(id)).filter((product) => Boolean(product));
|
|
720
|
+
async getProductByIds(ids) {
|
|
721
|
+
return this.store.products.getProductByIds(ids);
|
|
772
722
|
}
|
|
773
723
|
/**
|
|
774
724
|
* 获取日程时间段点
|
|
@@ -1203,8 +1153,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1203
1153
|
}
|
|
1204
1154
|
/** 读取当前 booking config。 */
|
|
1205
1155
|
getBookingConfig() {
|
|
1206
|
-
|
|
1207
|
-
return (_a = this.store.bookingContext) == null ? void 0 : _a.getBookingConfig();
|
|
1156
|
+
return this.store.bookingContext.getBookingConfig();
|
|
1208
1157
|
}
|
|
1209
1158
|
/** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
|
|
1210
1159
|
setResources(resources) {
|
|
@@ -1440,9 +1389,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1440
1389
|
decideAddProduct: (item, options) => this.decideAddProduct(item, options),
|
|
1441
1390
|
decideAfterDetail: (cacheItem, options) => this.decideAfterDetail(cacheItem, options),
|
|
1442
1391
|
transformDetailToProductAndBooking: (input) => this.transformDetailToProductAndBooking(input),
|
|
1443
|
-
addProductToOrder: (product, booking) => this.addProductToOrder(product, booking)
|
|
1444
|
-
refreshWalletAssets: (params) => this.refreshWalletAssets(params),
|
|
1445
|
-
scanWalletAsset: (scanCode) => this.scanWalletAsset(scanCode)
|
|
1392
|
+
addProductToOrder: (product, booking) => this.addProductToOrder(product, booking)
|
|
1446
1393
|
},
|
|
1447
1394
|
formatted,
|
|
1448
1395
|
bridge
|
|
@@ -1579,8 +1526,8 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
|
|
|
1579
1526
|
return result;
|
|
1580
1527
|
}
|
|
1581
1528
|
async setOtherParams(params, { cover = false } = {}) {
|
|
1582
|
-
|
|
1583
|
-
if (
|
|
1529
|
+
super.setOtherParams(params, { cover });
|
|
1530
|
+
if (params == null ? void 0 : params.businessCode) {
|
|
1584
1531
|
await this.configureIdGeneratorFromOpenData();
|
|
1585
1532
|
}
|
|
1586
1533
|
}
|
|
@@ -44,7 +44,6 @@ module.exports = __toCommonJS(addProductDecision_exports);
|
|
|
44
44
|
var import_dayjs = __toESM(require("dayjs"));
|
|
45
45
|
var import_BookingContext = require("../../../modules/BookingContext");
|
|
46
46
|
var import_transformBaseProductToOrderProduct = require("../../BaseSales/utils/transformBaseProductToOrderProduct");
|
|
47
|
-
var import_weighingProductSku = require("./weighingProductSku");
|
|
48
47
|
function needsSpecDetailModal(item) {
|
|
49
48
|
if (item == null ? void 0 : item.open_sold_weight)
|
|
50
49
|
return true;
|
|
@@ -282,14 +281,11 @@ function buildBasePayloadFromCacheItem(cacheItem, ctx) {
|
|
|
282
281
|
const quantity = (ctx == null ? void 0 : ctx.quantity) != null && ctx.quantity > 0 ? ctx.quantity : ((_b = cacheItem == null ? void 0 : cacheItem._extend) == null ? void 0 : _b.quantity) ?? 1;
|
|
283
282
|
const resolvedPid = (cacheItem == null ? void 0 : cacheItem.product_id) ?? (cacheItem == null ? void 0 : cacheItem.id);
|
|
284
283
|
const extend = (cacheItem == null ? void 0 : cacheItem._extend) || {};
|
|
285
|
-
const productSku = (0, import_weighingProductSku.buildProductSkuFromCacheItem)(cacheItem);
|
|
286
284
|
return {
|
|
287
285
|
id: (cacheItem == null ? void 0 : cacheItem.id) ?? (cacheItem == null ? void 0 : cacheItem.product_id),
|
|
288
286
|
product_id: resolvedPid,
|
|
289
287
|
variant_id: (other == null ? void 0 : other.product_variant_id) ?? (other == null ? void 0 : other.variant_id) ?? 0,
|
|
290
288
|
quantity,
|
|
291
|
-
// 规格弹窗本次选择是 option 权威源,避免目录/旧订单里的空 option 覆盖它。
|
|
292
|
-
product_sku: productSku ? { ...productSku, option: (other == null ? void 0 : other.option) || [] } : void 0,
|
|
293
289
|
option: (other == null ? void 0 : other.option) || [],
|
|
294
290
|
bundle: (other == null ? void 0 : other.bundle) || ((_c = extend == null ? void 0 : extend.skuValue) == null ? void 0 : _c.bundle) || ((_d = extend == null ? void 0 : extend._skuValue) == null ? void 0 : _d.bundle) || [],
|
|
295
291
|
unique: other == null ? void 0 : other.unique,
|
|
@@ -24,14 +24,6 @@ export interface GlobalScanApplyHost {
|
|
|
24
24
|
cacheItem: any;
|
|
25
25
|
};
|
|
26
26
|
addProductToOrder(product: any, booking?: any): Promise<any>;
|
|
27
|
-
refreshWalletAssets?(params?: {
|
|
28
|
-
preserveSelection?: boolean;
|
|
29
|
-
}): Promise<any>;
|
|
30
|
-
scanWalletAsset?(code: string): Promise<{
|
|
31
|
-
type: 'walletCode' | 'normalCode';
|
|
32
|
-
asset?: any;
|
|
33
|
-
selected: boolean;
|
|
34
|
-
}>;
|
|
35
27
|
}
|
|
36
28
|
/**
|
|
37
29
|
* 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。
|
|
@@ -101,32 +101,13 @@ async function applyGlobalScan(host, formatted, bridge) {
|
|
|
101
101
|
return { status: "success", kind: "customer" };
|
|
102
102
|
}
|
|
103
103
|
if (searchType === "walletPass") {
|
|
104
|
+
if (!data) {
|
|
105
|
+
(_c = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _c.call(bridge, "fail", "pisell2.text.scan-global-failed");
|
|
106
|
+
return { status: "failed", reason: "invalid_data" };
|
|
107
|
+
}
|
|
104
108
|
const snapshot = host.getOrderCustomerSnapshot();
|
|
105
109
|
const scannedCustomerIsWalkIn = (0, import_cartView.isWalkInCustomer)(data);
|
|
106
|
-
const trySelectWalletAsset = async () => {
|
|
107
|
-
var _a2, _b2;
|
|
108
|
-
if (!host.scanWalletAsset)
|
|
109
|
-
return null;
|
|
110
|
-
const walletResult = await host.scanWalletAsset(scanCode).catch((error) => {
|
|
111
|
-
console.warn("[GlobalScan] Wallet asset lookup failed", error);
|
|
112
|
-
return null;
|
|
113
|
-
});
|
|
114
|
-
if (!walletResult)
|
|
115
|
-
return null;
|
|
116
|
-
if (walletResult.type !== "normalCode" || !walletResult.asset) {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
if (walletResult.selected) {
|
|
120
|
-
(_a2 = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _a2.call(bridge, "success");
|
|
121
|
-
return { status: "success", kind: "promotion" };
|
|
122
|
-
}
|
|
123
|
-
(_b2 = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _b2.call(bridge, "fail", "pisell2.text.goodpass.code-invalid-cart");
|
|
124
|
-
return { status: "failed", reason: "invalid_data" };
|
|
125
|
-
};
|
|
126
110
|
if ((0, import_cartView.isWalkInCustomer)(snapshot) || scannedCustomerIsWalkIn) {
|
|
127
|
-
const walletSelection2 = await trySelectWalletAsset();
|
|
128
|
-
if (walletSelection2)
|
|
129
|
-
return walletSelection2;
|
|
130
111
|
if (!(bridge == null ? void 0 : bridge.applyPromotionCode)) {
|
|
131
112
|
return { status: "failed", reason: "no_bridge" };
|
|
132
113
|
}
|
|
@@ -137,19 +118,6 @@ async function applyGlobalScan(host, formatted, bridge) {
|
|
|
137
118
|
return { status: "failed", reason: "invalid_data" };
|
|
138
119
|
}
|
|
139
120
|
host.setOrderCustomer(data);
|
|
140
|
-
await ((_c = host.refreshWalletAssets) == null ? void 0 : _c.call(host, { preserveSelection: false }));
|
|
141
|
-
const walletSelection = await trySelectWalletAsset();
|
|
142
|
-
if (walletSelection)
|
|
143
|
-
return walletSelection;
|
|
144
|
-
if (bridge == null ? void 0 : bridge.applyPromotionCode) {
|
|
145
|
-
const promotionResult = await bridge.applyPromotionCode(
|
|
146
|
-
scanCode,
|
|
147
|
-
Number((data == null ? void 0 : data.id) ?? (data == null ? void 0 : data.customer_id)) || void 0
|
|
148
|
-
);
|
|
149
|
-
if (promotionResult == null ? void 0 : promotionResult.isAvailable) {
|
|
150
|
-
return { status: "success", kind: "promotion" };
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
121
|
(_d = bridge == null ? void 0 : bridge.onNotify) == null ? void 0 : _d.call(bridge, "success", "pisell2.text.add-client-success");
|
|
154
122
|
return { status: "success", kind: "customer" };
|
|
155
123
|
}
|
|
@@ -83,7 +83,6 @@ export declare class SalesImpl extends BaseModule implements Module, SalesModule
|
|
|
83
83
|
private getBookingAppointmentStatus;
|
|
84
84
|
private isBookingIncludedInStats;
|
|
85
85
|
private getBookingOrderPaymentStatus;
|
|
86
|
-
private isUnpaidBooking;
|
|
87
86
|
private countBookingOrders;
|
|
88
87
|
private countCompletedBookings;
|
|
89
88
|
private groupBookingsByResource;
|
|
@@ -39,7 +39,6 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
39
39
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
40
40
|
var import_types = require("./types");
|
|
41
41
|
__reExport(Sales_exports, require("./types"), module.exports);
|
|
42
|
-
var UNPAID_PAYMENT_STATUSES = /* @__PURE__ */ new Set(["unpaid", "partially_paid", "payment_processing"]);
|
|
43
42
|
var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
44
43
|
// LoggerManager 实例
|
|
45
44
|
constructor(name, version) {
|
|
@@ -259,9 +258,6 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
259
258
|
var _a;
|
|
260
259
|
return String(((_a = booking.order) == null ? void 0 : _a.payment_status) ?? "");
|
|
261
260
|
}
|
|
262
|
-
isUnpaidBooking(booking) {
|
|
263
|
-
return UNPAID_PAYMENT_STATUSES.has(this.getBookingOrderPaymentStatus(booking));
|
|
264
|
-
}
|
|
265
261
|
countBookingOrders(bookings) {
|
|
266
262
|
const orderIds = /* @__PURE__ */ new Set();
|
|
267
263
|
bookings.forEach((booking) => {
|
|
@@ -635,7 +631,9 @@ var SalesImpl = class extends import_BaseModule.BaseModule {
|
|
|
635
631
|
const completedBookingList = matchedBookingList.filter(
|
|
636
632
|
(booking) => this.getBookingAppointmentStatus(booking) === "completed"
|
|
637
633
|
);
|
|
638
|
-
const unpaidBookingList = matchedBookingList.filter(
|
|
634
|
+
const unpaidBookingList = matchedBookingList.filter(
|
|
635
|
+
(booking) => this.getBookingOrderPaymentStatus(booking) === "unpaid" || this.getBookingOrderPaymentStatus(booking) === "payment_processing"
|
|
636
|
+
);
|
|
639
637
|
const bookings = this.pickBookingsForCurrentPoint(
|
|
640
638
|
current,
|
|
641
639
|
this.normalizeResourceBookings(current, deviceCurrent, matchedBookingList)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
-
import {
|
|
3
|
-
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderScanCodeResult } from './types';
|
|
2
|
+
import { BaseSalesImpl } from '../BaseSales';
|
|
3
|
+
import { ScanOrderAddLogParams, ScanOrderAvailabilityInfo, ScanOrderAllowAddItemsInfo, ScanOrderOrderProduct, ScanOrderOrderProductIdentity, ScanOrderReservationResourceSelectInfo, ScanOrderState, ScanOrderScanCodeResult, ScanOrderSyncAdditionalOrderResult } from './types';
|
|
4
4
|
import type { UpdateOrderProductParams } from '../../modules/Order/types';
|
|
5
5
|
import type { Discount } from '../../modules/Discount/types';
|
|
6
|
+
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
6
7
|
import { type CartItemSummary, type PaxInfo, type QuantityCheckResult, type QuantityLimitResult } from '../../model/strategy/adapter/itemRule';
|
|
7
8
|
import type { StrategyConfig } from '../../model/strategy/type';
|
|
8
9
|
import type { ProductData } from '../../modules/Product/types';
|
|
@@ -15,16 +16,16 @@ interface ScanOrderItemRuleRuntimeConfig {
|
|
|
15
16
|
submissionIndex?: number;
|
|
16
17
|
custom?: Record<string, any>;
|
|
17
18
|
}
|
|
18
|
-
export declare class ScanOrderImpl extends
|
|
19
|
+
export declare class ScanOrderImpl extends BaseSalesImpl implements Module {
|
|
19
20
|
protected defaultName: string;
|
|
20
21
|
protected defaultVersion: string;
|
|
21
22
|
isSolution: boolean;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
protected initializeOptions: ModuleOptions;
|
|
24
|
+
protected store: ScanOrderState;
|
|
25
|
+
protected otherParams: Record<string, any>;
|
|
26
|
+
protected cacheId: string | undefined;
|
|
27
|
+
window: WindowPlugin;
|
|
28
|
+
request: RequestPlugin;
|
|
28
29
|
private itemRuleEvaluator;
|
|
29
30
|
private itemRuleConfigs;
|
|
30
31
|
private itemRuleConfigsPromise;
|
|
@@ -53,9 +54,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
53
54
|
private registerCustomerLoginListeners;
|
|
54
55
|
private refreshOrderMarketingAfterLogin;
|
|
55
56
|
constructor(name?: string, version?: string);
|
|
57
|
+
protected getRegisteredModuleNames(): readonly string[];
|
|
58
|
+
protected createSubModule(moduleName: string): Module | null;
|
|
56
59
|
/** 与 `otherParams.cacheId` 一致,供宿主在 URL 变化时判断是否需要重新注册模块 */
|
|
57
60
|
getCacheId(): string | undefined;
|
|
58
|
-
private destroyRegisteredChildModules;
|
|
59
61
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
60
62
|
destroy(): Promise<void>;
|
|
61
63
|
retryInit(): Promise<void>;
|
|
@@ -71,12 +73,14 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
71
73
|
};
|
|
72
74
|
getTempOrder(): import("../../modules/Order/types").OrderTempOrder | null;
|
|
73
75
|
updateTempOrderNote(note: string): string;
|
|
76
|
+
updateTempOrderNote(note: string, sync: true): Promise<string>;
|
|
77
|
+
updateTempOrderNote(note: string, sync: boolean): string | Promise<string>;
|
|
74
78
|
setPickupReferenceMode(mode: 'counter_pickup' | 'table_service'): {
|
|
75
|
-
service_type: 'dine_in';
|
|
79
|
+
service_type: 'dine_in' | '';
|
|
76
80
|
pickup_reference_mode: 'counter_pickup' | 'table_service';
|
|
77
81
|
};
|
|
78
82
|
setPickupRef(buzzer: string): string;
|
|
79
|
-
private
|
|
83
|
+
private ensureScanOrderTempOrder;
|
|
80
84
|
addNewOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
81
85
|
restoreOrder(): Promise<import("../../modules/Order/types").OrderTempOrder>;
|
|
82
86
|
getOrderProducts(): import("../../modules/Order/types").OrderProduct[];
|
|
@@ -92,7 +96,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
92
96
|
}): Promise<void>;
|
|
93
97
|
private findReservationRuleResource;
|
|
94
98
|
private buildScanOrderResourceMetadata;
|
|
99
|
+
private prepareRetailAvailability;
|
|
95
100
|
private buildSubmitPayloadEnhancer;
|
|
101
|
+
private isScanOrderMoreMode;
|
|
102
|
+
private submitScanOrderMore;
|
|
96
103
|
submitScanOrder<T = any>(): Promise<T>;
|
|
97
104
|
addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
98
105
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
@@ -117,8 +124,10 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
117
124
|
setItemRuleRuntimeConfig(config?: ScanOrderItemRuleRuntimeConfig): Promise<void>;
|
|
118
125
|
private normalizeResourceState;
|
|
119
126
|
private resolveResourceSelectType;
|
|
120
|
-
private
|
|
121
|
-
|
|
127
|
+
private fetchResourceOccupyDetailsByResourceId;
|
|
128
|
+
private resolveAdditionalOrderFromOccupyDetail;
|
|
129
|
+
checkResourceAvailable(resourceId?: string | null, hasOrderId?: boolean): Promise<ScanOrderAvailabilityInfo>;
|
|
130
|
+
restorePreviousOrderData(): Promise<void>;
|
|
122
131
|
getAdditionalOrderInfo(): Promise<{
|
|
123
132
|
orderId: string;
|
|
124
133
|
orderStatus: 'pending' | 'processing' | 'completed' | 'cancelled';
|
|
@@ -141,6 +150,9 @@ export declare class ScanOrderImpl extends BaseModule implements Module {
|
|
|
141
150
|
clearUIState(): void;
|
|
142
151
|
setEntryPaxNumber(number: number): Promise<void>;
|
|
143
152
|
getEntryPaxNumber(): number | null;
|
|
153
|
+
syncAdditionalOrderFromResource(resourceId?: string | null): Promise<ScanOrderSyncAdditionalOrderResult>;
|
|
154
|
+
getReservationResourceSelectType(): ScanOrderReservationResourceSelectInfo;
|
|
155
|
+
checkAllowAddItems(): ScanOrderAllowAddItemsInfo;
|
|
144
156
|
getFulfillmentModes(): {
|
|
145
157
|
enablePickup: boolean;
|
|
146
158
|
enableTableService: boolean;
|