@pisell/pisellos 0.10.60 → 0.10.62
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/inventory/index.js +12 -3
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +4 -4
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/lib/inventory/index.js +9 -2
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +3 -3
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/package.json +1 -1
package/dist/inventory/index.js
CHANGED
|
@@ -338,12 +338,21 @@ export var InventoryController = /*#__PURE__*/function () {
|
|
|
338
338
|
return _this4.availabilityForKey(key);
|
|
339
339
|
});
|
|
340
340
|
if (!states.length) return this.availabilityForKey();
|
|
341
|
-
|
|
341
|
+
// Unmapped variants are not offered by this source. Exclude even their last
|
|
342
|
+
// known quantities, while preserving errors on variants that are configured.
|
|
343
|
+
var mappedStates = states.filter(function (entry) {
|
|
344
|
+
return entry.status !== 'unmapped';
|
|
345
|
+
});
|
|
346
|
+
if (!mappedStates.length) return {
|
|
347
|
+
status: 'unmapped',
|
|
348
|
+
message: this.source.message('unmapped')
|
|
349
|
+
};
|
|
350
|
+
var quantity = mappedStates.every(function (entry) {
|
|
342
351
|
return entry.quantity !== undefined;
|
|
343
|
-
}) ?
|
|
352
|
+
}) ? mappedStates.reduce(function (sum, entry) {
|
|
344
353
|
return sum + entry.quantity;
|
|
345
354
|
}, 0) : undefined;
|
|
346
|
-
var failed =
|
|
355
|
+
var failed = mappedStates.find(function (entry) {
|
|
347
356
|
return entry.status !== 'ready';
|
|
348
357
|
});
|
|
349
358
|
if (quantity !== undefined && !Number.isSafeInteger(quantity)) return {
|
|
@@ -266,6 +266,7 @@ export var DiscountModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
266
266
|
_context5.next = 3;
|
|
267
267
|
return this.request.get("/machinecode/batch-search", _objectSpread(_objectSpread({
|
|
268
268
|
code: code,
|
|
269
|
+
resolve_ticket_order: 1,
|
|
269
270
|
translate_flag: 1,
|
|
270
271
|
tags: ['entitlement_pass', 'good_pass', 'product_discount_card'],
|
|
271
272
|
// available: 1,
|
|
@@ -609,7 +609,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
609
609
|
generateIdempotencyToken(): string;
|
|
610
610
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
611
611
|
createOrder(params: CommitOrderParams['query']): {
|
|
612
|
-
type: "
|
|
612
|
+
type: "appointment_booking" | "virtual";
|
|
613
613
|
platform: string;
|
|
614
614
|
sales_channel: string;
|
|
615
615
|
order_sales_channel: string;
|
|
@@ -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" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -373,7 +373,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
373
373
|
};
|
|
374
374
|
setOtherData(key: string, value: any): void;
|
|
375
375
|
getOtherData(key: string): any;
|
|
376
|
-
getProductTypeById(id: number): Promise<"
|
|
376
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
377
377
|
/**
|
|
378
378
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
379
379
|
*
|
|
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
|
|
|
5
5
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
6
6
|
*
|
|
7
7
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
8
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
8
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
9
9
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
10
10
|
*/
|
|
11
11
|
export type AddProductDecision = {
|
|
@@ -8,12 +8,13 @@ import dayjs from 'dayjs';
|
|
|
8
8
|
import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend } from "../../../modules/BookingContext";
|
|
9
9
|
import { transformBaseProductToOrderProduct } from "../../BaseSales/utils/transformBaseProductToOrderProduct";
|
|
10
10
|
import { buildProductSkuFromCacheItem } from "./weighingProductSku";
|
|
11
|
+
import { isSelfServicePlatform } from "../../../utils/platform";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
14
15
|
*
|
|
15
16
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
16
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
17
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
17
18
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
18
19
|
*/
|
|
19
20
|
|
|
@@ -30,11 +31,11 @@ function needsSpecDetailModal(item) {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
|
-
* 第二段:预约商品是否仍需打开资源 /
|
|
34
|
+
* 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
34
35
|
*/
|
|
35
36
|
function needsBookingEdit(cacheItem, ctx) {
|
|
36
37
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
37
|
-
if ((ctx === null || ctx === void 0 ? void 0 : ctx.channel)
|
|
38
|
+
if (isSelfServicePlatform(ctx === null || ctx === void 0 ? void 0 : ctx.channel)) return true;
|
|
38
39
|
var isAutoAllocationOn = (ctx === null || ctx === void 0 ? void 0 : ctx.isAutoAllocationOn) || function () {
|
|
39
40
|
return true;
|
|
40
41
|
};
|
|
@@ -10,6 +10,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
10
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
11
|
import { searchWalletPass, searchWallet, searchProduct, searchOrder } from "./cloudSearch";
|
|
12
12
|
import scanCache from "./scanCache";
|
|
13
|
+
import { isSelfServicePlatform } from "../../../../utils/platform";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Promise.any 的替代实现
|
|
@@ -161,7 +162,7 @@ export var handleGlobalScan = function handleGlobalScan(request, localSearch, ch
|
|
|
161
162
|
if (value.startsWith('WL')) {
|
|
162
163
|
requestList = [searchWallet(request, value)];
|
|
163
164
|
} else {
|
|
164
|
-
requestList = [].concat(_toConsumableArray(channel
|
|
165
|
+
requestList = [].concat(_toConsumableArray(isSelfServicePlatform(channel) ? [] : [searchOrder(request, value)]), [searchWalletPass(request, value), searchWallet(request, value), searchProduct(request, value)]);
|
|
165
166
|
}
|
|
166
167
|
return requestList;
|
|
167
168
|
};
|
|
@@ -145,7 +145,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
145
145
|
*/
|
|
146
146
|
clearSessionStorageOrderSnapshot(): void;
|
|
147
147
|
/**
|
|
148
|
-
* PC/H5
|
|
148
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
149
149
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
150
150
|
*/
|
|
151
151
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
@@ -45,7 +45,7 @@ import { AvailabilityRemoteOccupancyCache } from "./remoteOccupancyCache";
|
|
|
45
45
|
import { BusinessAvailabilityController } from "./businessAvailability";
|
|
46
46
|
import { BookingTicket } from "../BookingTicket";
|
|
47
47
|
import { addLocalCalendarDays, captureRuntimeOffsetMinutes, formatLocalDate, formatLocalDateTime, formatLocalTime, localDateTimeToScalar, localDateToScalar, localDateToScalarStart, parseLocalDate, parseLocalDateTime } from "../../modules/ResourcePlanner/localClock";
|
|
48
|
-
import { isCustomerUserPlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
48
|
+
import { isCustomerUserPlatform, isSelfServicePlatform, normalizeRuntimePlatform } from "../../utils/platform";
|
|
49
49
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
50
50
|
export * from "./types";
|
|
51
51
|
export { AvailabilityError } from "../../modules/ResourcePlanner";
|
|
@@ -2005,7 +2005,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2005
2005
|
}
|
|
2006
2006
|
|
|
2007
2007
|
/**
|
|
2008
|
-
* PC/H5
|
|
2008
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
2009
2009
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
2010
2010
|
*/
|
|
2011
2011
|
}, {
|
|
@@ -2015,7 +2015,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2015
2015
|
var configured = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.checkoutSyncTaskEnabled;
|
|
2016
2016
|
if (configured === true) return true;
|
|
2017
2017
|
var platform = normalizeRuntimePlatform((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform);
|
|
2018
|
-
return !isCustomerUserPlatform(platform) && platform
|
|
2018
|
+
return !isCustomerUserPlatform(platform) && !isSelfServicePlatform(platform);
|
|
2019
2019
|
}
|
|
2020
2020
|
|
|
2021
2021
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -2838,7 +2838,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
2838
2838
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
2839
2839
|
case 3:
|
|
2840
2840
|
policyUrl = 'shop-policy';
|
|
2841
|
-
if (this.otherParams.platform
|
|
2841
|
+
if (isSelfServicePlatform(this.otherParams.platform) || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
2842
2842
|
policyUrl = 'policy';
|
|
2843
2843
|
}
|
|
2844
2844
|
return _context23.abrupt("return", this.request.get("/".concat(policyUrl, "/").concat(encodeURIComponent(normalizedPolicyId))));
|
package/dist/utils/platform.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export declare function normalizeRuntimePlatform(platform: unknown): string;
|
|
|
6
6
|
* PC and H5 are authenticated-customer clients rather than staff terminals.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isCustomerUserPlatform(platform: unknown): boolean;
|
|
9
|
+
/** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
|
|
10
|
+
export declare function isSelfServicePlatform(platform: unknown): boolean;
|
package/dist/utils/platform.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
var CUSTOMER_USER_PLATFORMS = new Set(['pc', 'h5']);
|
|
2
|
+
var SELF_SERVICE_PLATFORMS = new Set(['kiosk', 'vending']);
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Normalize the runtime platform passed through solution/module otherParams.
|
|
@@ -12,4 +13,9 @@ export function normalizeRuntimePlatform(platform) {
|
|
|
12
13
|
*/
|
|
13
14
|
export function isCustomerUserPlatform(platform) {
|
|
14
15
|
return CUSTOMER_USER_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
|
|
19
|
+
export function isSelfServicePlatform(platform) {
|
|
20
|
+
return SELF_SERVICE_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
15
21
|
}
|
package/lib/inventory/index.js
CHANGED
|
@@ -175,8 +175,15 @@ class InventoryController {
|
|
|
175
175
|
const keys = [...new Set(this.products.get(String(id))?.values() || [])];
|
|
176
176
|
const states = keys.map(key => this.availabilityForKey(key));
|
|
177
177
|
if (!states.length) return this.availabilityForKey();
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
// Unmapped variants are not offered by this source. Exclude even their last
|
|
179
|
+
// known quantities, while preserving errors on variants that are configured.
|
|
180
|
+
const mappedStates = states.filter(entry => entry.status !== 'unmapped');
|
|
181
|
+
if (!mappedStates.length) return {
|
|
182
|
+
status: 'unmapped',
|
|
183
|
+
message: this.source.message('unmapped')
|
|
184
|
+
};
|
|
185
|
+
const quantity = mappedStates.every(entry => entry.quantity !== undefined) ? mappedStates.reduce((sum, entry) => sum + entry.quantity, 0) : undefined;
|
|
186
|
+
const failed = mappedStates.find(entry => entry.status !== 'ready');
|
|
180
187
|
if (quantity !== undefined && !Number.isSafeInteger(quantity)) return {
|
|
181
188
|
status: 'error',
|
|
182
189
|
message: this.source.message('unavailable')
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "BUY_X_GET_Y_FREE_STRATEGY", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _examples.BUY_X_GET_Y_FREE_STRATEGY;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ITEM_REWARD_STRATEGY", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _examples.ITEM_REWARD_STRATEGY;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "PromotionAdapter", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _adapter.PromotionAdapter;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "PromotionEvaluator", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _evaluator.PromotionEvaluator;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "X_ITEMS_FOR_Y_PRICE_STRATEGY", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _examples.X_ITEMS_FOR_Y_PRICE_STRATEGY;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "default", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return _adapter.default;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
var _evaluator = require("./evaluator");
|
|
43
|
-
var _adapter = _interopRequireWildcard(require("./adapter"));
|
|
44
|
-
var _examples = require("./examples");
|
|
45
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
46
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
1
|
+
"use strict";
|
|
@@ -142,6 +142,7 @@ class DiscountModule extends _BaseModule.BaseModule {
|
|
|
142
142
|
} = options || {};
|
|
143
143
|
const result = await this.request.get(`/machinecode/batch-search`, {
|
|
144
144
|
code,
|
|
145
|
+
resolve_ticket_order: 1,
|
|
145
146
|
translate_flag: 1,
|
|
146
147
|
tags: ['entitlement_pass', 'good_pass', 'product_discount_card'],
|
|
147
148
|
// available: 1,
|
|
@@ -609,7 +609,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
609
609
|
generateIdempotencyToken(): string;
|
|
610
610
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
611
611
|
createOrder(params: CommitOrderParams['query']): {
|
|
612
|
-
type: "
|
|
612
|
+
type: "appointment_booking" | "virtual";
|
|
613
613
|
platform: string;
|
|
614
614
|
sales_channel: string;
|
|
615
615
|
order_sales_channel: string;
|
|
@@ -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" | "session" | "normal";
|
|
53
53
|
}
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -373,7 +373,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
373
373
|
};
|
|
374
374
|
setOtherData(key: string, value: any): void;
|
|
375
375
|
getOtherData(key: string): any;
|
|
376
|
-
getProductTypeById(id: number): Promise<"
|
|
376
|
+
getProductTypeById(id: number): Promise<"duration" | "session" | "normal">;
|
|
377
377
|
/**
|
|
378
378
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
379
379
|
*
|
|
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
|
|
|
5
5
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
6
6
|
*
|
|
7
7
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
8
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
8
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
9
9
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
10
10
|
*/
|
|
11
11
|
export type AddProductDecision = {
|
|
@@ -17,12 +17,13 @@ var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
|
17
17
|
var _BookingContext = require("../../../modules/BookingContext");
|
|
18
18
|
var _transformBaseProductToOrderProduct = require("../../BaseSales/utils/transformBaseProductToOrderProduct");
|
|
19
19
|
var _weighingProductSku = require("./weighingProductSku");
|
|
20
|
+
var _platform = require("../../../utils/platform");
|
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
22
|
/**
|
|
22
23
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
23
24
|
*
|
|
24
25
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
25
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
26
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
26
27
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
27
28
|
*/
|
|
28
29
|
|
|
@@ -39,11 +40,11 @@ function needsSpecDetailModal(item) {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
|
-
* 第二段:预约商品是否仍需打开资源 /
|
|
43
|
+
* 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
43
44
|
*/
|
|
44
45
|
function needsBookingEdit(cacheItem, ctx) {
|
|
45
46
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
46
|
-
if (ctx?.channel
|
|
47
|
+
if ((0, _platform.isSelfServicePlatform)(ctx?.channel)) return true;
|
|
47
48
|
const isAutoAllocationOn = ctx?.isAutoAllocationOn || (() => true);
|
|
48
49
|
return !(0, _BookingContext.getIsAutoClose)(cacheItem, isAutoAllocationOn);
|
|
49
50
|
}
|
|
@@ -10,6 +10,7 @@ exports.searchWalletPass = exports.searchWallet = exports.searchProduct = export
|
|
|
10
10
|
const searchWalletPass = async (request, code) => {
|
|
11
11
|
const params = {
|
|
12
12
|
code,
|
|
13
|
+
resolve_ticket_order: 1,
|
|
13
14
|
translate_flag: 1,
|
|
14
15
|
// 翻译识别码名称 0:不翻译 1:翻译
|
|
15
16
|
relation_product: 1,
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.handleUniversalScan = exports.handleGlobalScan = exports.handleCustomerScan = void 0;
|
|
7
7
|
var _cloudSearch = require("./cloudSearch");
|
|
8
8
|
var _scanCache = _interopRequireDefault(require("./scanCache"));
|
|
9
|
+
var _platform = require("../../../../utils/platform");
|
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
11
|
/**
|
|
11
12
|
* Promise.any 的替代实现
|
|
@@ -107,7 +108,7 @@ const handleGlobalScan = (request, localSearch, channel) => {
|
|
|
107
108
|
if (value.startsWith('WL')) {
|
|
108
109
|
requestList = [(0, _cloudSearch.searchWallet)(request, value)];
|
|
109
110
|
} else {
|
|
110
|
-
requestList = [...(channel
|
|
111
|
+
requestList = [...((0, _platform.isSelfServicePlatform)(channel) ? [] : [(0, _cloudSearch.searchOrder)(request, value)]), (0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
|
|
111
112
|
}
|
|
112
113
|
return requestList;
|
|
113
114
|
};
|
|
@@ -145,7 +145,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
145
145
|
*/
|
|
146
146
|
clearSessionStorageOrderSnapshot(): void;
|
|
147
147
|
/**
|
|
148
|
-
* PC/H5
|
|
148
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
149
149
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
150
150
|
*/
|
|
151
151
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
@@ -1653,14 +1653,14 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1653
1653
|
}
|
|
1654
1654
|
|
|
1655
1655
|
/**
|
|
1656
|
-
* PC/H5
|
|
1656
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
1657
1657
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
1658
1658
|
*/
|
|
1659
1659
|
shouldUseCheckoutSyncTask() {
|
|
1660
1660
|
const configured = this.otherParams?.checkoutSyncTaskEnabled;
|
|
1661
1661
|
if (configured === true) return true;
|
|
1662
1662
|
const platform = (0, _platform.normalizeRuntimePlatform)(this.otherParams?.platform);
|
|
1663
|
-
return !(0, _platform.isCustomerUserPlatform)(platform) && platform
|
|
1663
|
+
return !(0, _platform.isCustomerUserPlatform)(platform) && !(0, _platform.isSelfServicePlatform)(platform);
|
|
1664
1664
|
}
|
|
1665
1665
|
|
|
1666
1666
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -2017,7 +2017,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2017
2017
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
2018
2018
|
}
|
|
2019
2019
|
let policyUrl = 'shop-policy';
|
|
2020
|
-
if (this.otherParams.platform
|
|
2020
|
+
if ((0, _platform.isSelfServicePlatform)(this.otherParams.platform) || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
2021
2021
|
policyUrl = 'policy';
|
|
2022
2022
|
}
|
|
2023
2023
|
return this.request.get(`/${policyUrl}/${encodeURIComponent(normalizedPolicyId)}`);
|
package/lib/utils/platform.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export declare function normalizeRuntimePlatform(platform: unknown): string;
|
|
|
6
6
|
* PC and H5 are authenticated-customer clients rather than staff terminals.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isCustomerUserPlatform(platform: unknown): boolean;
|
|
9
|
+
/** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
|
|
10
|
+
export declare function isSelfServicePlatform(platform: unknown): boolean;
|
package/lib/utils/platform.js
CHANGED
|
@@ -4,8 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isCustomerUserPlatform = isCustomerUserPlatform;
|
|
7
|
+
exports.isSelfServicePlatform = isSelfServicePlatform;
|
|
7
8
|
exports.normalizeRuntimePlatform = normalizeRuntimePlatform;
|
|
8
9
|
const CUSTOMER_USER_PLATFORMS = new Set(['pc', 'h5']);
|
|
10
|
+
const SELF_SERVICE_PLATFORMS = new Set(['kiosk', 'vending']);
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Normalize the runtime platform passed through solution/module otherParams.
|
|
@@ -19,4 +21,9 @@ function normalizeRuntimePlatform(platform) {
|
|
|
19
21
|
*/
|
|
20
22
|
function isCustomerUserPlatform(platform) {
|
|
21
23
|
return CUSTOMER_USER_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
|
|
27
|
+
function isSelfServicePlatform(platform) {
|
|
28
|
+
return SELF_SERVICE_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
22
29
|
}
|