@pisell/pisellos 0.10.21 → 0.10.23
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 +3 -0
- package/dist/modules/BookingContext/index.js +42 -13
- package/dist/modules/BookingContext/types.d.ts +4 -4
- package/dist/modules/BookingContext/types.js +3 -3
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +10 -7
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +28 -9
- package/dist/modules/Order/index.d.ts +5 -0
- package/dist/modules/Order/index.js +148 -84
- package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
- package/dist/modules/ProductList/clientDataVariants.js +216 -0
- package/dist/modules/ProductList/index.d.ts +14 -13
- package/dist/modules/ProductList/index.js +105 -77
- package/dist/modules/Quotation/index.d.ts +16 -0
- package/dist/modules/Quotation/index.js +240 -27
- package/dist/modules/ResourcePlanner/planner.d.ts +2 -2
- package/dist/modules/ResourcePlanner/planner.js +88 -21
- package/dist/modules/ResourcePlanner/types.d.ts +12 -0
- package/dist/modules/Rules/index.d.ts +5 -0
- package/dist/modules/Rules/index.js +27 -12
- package/dist/solution/BaseSales/index.d.ts +16 -1
- package/dist/solution/BaseSales/index.js +667 -349
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Sales/index.js +5 -3
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +290 -81
- package/dist/solution/UnifiedBookingSales/types.d.ts +4 -0
- package/dist/solution/VenueBooking/index.d.ts +2 -0
- package/dist/solution/VenueBooking/index.js +542 -494
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
- package/dist/utils/platform.d.ts +8 -0
- package/dist/utils/platform.js +15 -0
- package/lib/modules/BookingContext/index.d.ts +3 -0
- package/lib/modules/BookingContext/index.js +35 -8
- package/lib/modules/BookingContext/types.d.ts +4 -4
- package/lib/modules/BookingContext/types.js +3 -3
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +4 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +13 -0
- package/lib/modules/Order/index.d.ts +5 -0
- package/lib/modules/Order/index.js +65 -8
- package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
- package/lib/modules/ProductList/clientDataVariants.js +204 -0
- package/lib/modules/ProductList/index.d.ts +14 -13
- package/lib/modules/ProductList/index.js +77 -58
- package/lib/modules/Quotation/index.d.ts +16 -0
- package/lib/modules/Quotation/index.js +112 -9
- package/lib/modules/ResourcePlanner/planner.d.ts +2 -2
- package/lib/modules/ResourcePlanner/planner.js +80 -20
- package/lib/modules/ResourcePlanner/types.d.ts +12 -0
- package/lib/modules/Rules/index.d.ts +5 -0
- package/lib/modules/Rules/index.js +20 -11
- package/lib/solution/BaseSales/index.d.ts +16 -1
- package/lib/solution/BaseSales/index.js +293 -66
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Sales/index.js +2 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +225 -20
- package/lib/solution/UnifiedBookingSales/types.d.ts +4 -0
- package/lib/solution/VenueBooking/index.d.ts +2 -0
- package/lib/solution/VenueBooking/index.js +28 -8
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
- package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
- package/lib/utils/platform.d.ts +8 -0
- package/lib/utils/platform.js +22 -0
- package/package.json +1 -1
|
@@ -19,12 +19,15 @@ export declare class BookingContextModule extends BaseModule implements Module,
|
|
|
19
19
|
protected defaultVersion: string;
|
|
20
20
|
private request;
|
|
21
21
|
private store;
|
|
22
|
+
private otherParams;
|
|
22
23
|
/** 上次成功 loadBookingConfig 的 query key;命中则不再请求。 */
|
|
23
24
|
private lastConfigQueryKey;
|
|
24
25
|
/** 上次成功 loadResources 的 query key(date|bookingIds);命中则不再请求。 */
|
|
25
26
|
private lastResourcesQueryKey;
|
|
26
27
|
constructor(name?: string, version?: string);
|
|
27
28
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
29
|
+
/** 同步父级解决方案的运行态参数;platform 变化后会自然切换 config endpoint/cache key。 */
|
|
30
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
28
31
|
loadBookingConfig(params?: LoadBookingConfigParams, options?: {
|
|
29
32
|
forceRefresh?: boolean;
|
|
30
33
|
}): Promise<BookingContextConfig | null>;
|
|
@@ -26,6 +26,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
26
26
|
import dayjs from 'dayjs';
|
|
27
27
|
import { BaseModule } from "../BaseModule";
|
|
28
28
|
import { RequestModeENUM } from "../../plugins/request";
|
|
29
|
+
import { normalizeRuntimePlatform } from "../../utils/platform";
|
|
29
30
|
import { BookingContextEvent } from "./types";
|
|
30
31
|
import { formatResourceListAndMap } from "./utils/formatResourceList";
|
|
31
32
|
export * from "./types";
|
|
@@ -40,6 +41,8 @@ var DEFAULT_BOOKING_CONFIG_PARAMS = {
|
|
|
40
41
|
item_type: 'appointment_booking',
|
|
41
42
|
sub_type: 'ticket'
|
|
42
43
|
};
|
|
44
|
+
var BOOKING_CONFIG_ENDPOINT = '/core/board/management/config';
|
|
45
|
+
var H5_BOOKING_CONFIG_ENDPOINT = '/core/board/config';
|
|
43
46
|
var BOARD_CONFIG_CACHE = {
|
|
44
47
|
useCache: true,
|
|
45
48
|
cache: {
|
|
@@ -153,6 +156,24 @@ export function buildBookingConfigQueryKey() {
|
|
|
153
156
|
});
|
|
154
157
|
return JSON.stringify(sorted);
|
|
155
158
|
}
|
|
159
|
+
function resolveBookingConfigRequest(platform) {
|
|
160
|
+
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
161
|
+
var isH5 = normalizeRuntimePlatform(platform) === 'h5';
|
|
162
|
+
var endpoint = isH5 ? H5_BOOKING_CONFIG_ENDPOINT : BOOKING_CONFIG_ENDPOINT;
|
|
163
|
+
var query = isH5 ? {
|
|
164
|
+
item_type: params.item_type || DEFAULT_BOOKING_CONFIG_PARAMS.item_type
|
|
165
|
+
} : _objectSpread(_objectSpread({}, DEFAULT_BOOKING_CONFIG_PARAMS), params);
|
|
166
|
+
var keys = Object.keys(query).sort();
|
|
167
|
+
var sortedQuery = {};
|
|
168
|
+
keys.forEach(function (key) {
|
|
169
|
+
sortedQuery[key] = query[key];
|
|
170
|
+
});
|
|
171
|
+
return {
|
|
172
|
+
endpoint: endpoint,
|
|
173
|
+
query: query,
|
|
174
|
+
key: "".concat(endpoint, ":").concat(JSON.stringify(sortedQuery))
|
|
175
|
+
};
|
|
176
|
+
}
|
|
156
177
|
|
|
157
178
|
/** 稳定序列化资源列表查询(date + bookingIds),用于跳过重复 loadResources。 */
|
|
158
179
|
export function buildBookingResourcesQueryKey() {
|
|
@@ -176,6 +197,7 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
176
197
|
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
177
198
|
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
178
199
|
_defineProperty(_assertThisInitialized(_this), "store", _objectSpread({}, EMPTY_STATE));
|
|
200
|
+
_defineProperty(_assertThisInitialized(_this), "otherParams", {});
|
|
179
201
|
/** 上次成功 loadBookingConfig 的 query key;命中则不再请求。 */
|
|
180
202
|
_defineProperty(_assertThisInitialized(_this), "lastConfigQueryKey", null);
|
|
181
203
|
/** 上次成功 loadResources 的 query key(date|bookingIds);命中则不再请求。 */
|
|
@@ -201,6 +223,7 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
201
223
|
}
|
|
202
224
|
throw new Error('BookingContextModule 需要 request 插件支持');
|
|
203
225
|
case 5:
|
|
226
|
+
this.otherParams = options.otherParams || {};
|
|
204
227
|
this.store = {
|
|
205
228
|
bookingConfig: null,
|
|
206
229
|
resourcesOrigin: [],
|
|
@@ -218,7 +241,7 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
218
241
|
if (initialState.date) {
|
|
219
242
|
this.store.date = initialState.date;
|
|
220
243
|
}
|
|
221
|
-
case
|
|
244
|
+
case 11:
|
|
222
245
|
case "end":
|
|
223
246
|
return _context.stop();
|
|
224
247
|
}
|
|
@@ -228,16 +251,22 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
228
251
|
return _initialize.apply(this, arguments);
|
|
229
252
|
}
|
|
230
253
|
return initialize;
|
|
231
|
-
}()
|
|
254
|
+
}() /** 同步父级解决方案的运行态参数;platform 变化后会自然切换 config endpoint/cache key。 */
|
|
255
|
+
}, {
|
|
256
|
+
key: "updateOtherParams",
|
|
257
|
+
value: function updateOtherParams(params) {
|
|
258
|
+
this.otherParams = params || {};
|
|
259
|
+
}
|
|
232
260
|
}, {
|
|
233
261
|
key: "loadBookingConfig",
|
|
234
262
|
value: function () {
|
|
235
263
|
var _loadBookingConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
236
|
-
var
|
|
264
|
+
var _this$otherParams,
|
|
265
|
+
_this2 = this;
|
|
237
266
|
var params,
|
|
238
267
|
options,
|
|
268
|
+
requestConfig,
|
|
239
269
|
configKey,
|
|
240
|
-
query,
|
|
241
270
|
sharedKey,
|
|
242
271
|
_sharedBookingConfigC,
|
|
243
272
|
cached,
|
|
@@ -250,14 +279,14 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
250
279
|
case 0:
|
|
251
280
|
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
252
281
|
options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
253
|
-
|
|
282
|
+
requestConfig = resolveBookingConfigRequest((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform, params);
|
|
283
|
+
configKey = requestConfig.key;
|
|
254
284
|
if (!(!options.forceRefresh && this.store.bookingConfig != null && this.lastConfigQueryKey === configKey)) {
|
|
255
|
-
_context3.next =
|
|
285
|
+
_context3.next = 6;
|
|
256
286
|
break;
|
|
257
287
|
}
|
|
258
288
|
return _context3.abrupt("return", this.store.bookingConfig);
|
|
259
|
-
case
|
|
260
|
-
query = _objectSpread(_objectSpread({}, DEFAULT_BOOKING_CONFIG_PARAMS), params);
|
|
289
|
+
case 6:
|
|
261
290
|
sharedKey = buildSharedCacheKey(this.request, configKey);
|
|
262
291
|
if (!(!options.forceRefresh && sharedBookingConfigCache.has(sharedKey))) {
|
|
263
292
|
_context3.next = 12;
|
|
@@ -277,7 +306,7 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
277
306
|
case 0:
|
|
278
307
|
_context2.prev = 0;
|
|
279
308
|
_context2.next = 3;
|
|
280
|
-
return _this2.request.get(
|
|
309
|
+
return _this2.request.get(requestConfig.endpoint, requestConfig.query, BOARD_CONFIG_CACHE);
|
|
281
310
|
case 3:
|
|
282
311
|
res = _context2.sent;
|
|
283
312
|
_config = (_res$data = res === null || res === void 0 ? void 0 : res.data) !== null && _res$data !== void 0 ? _res$data : null;
|
|
@@ -411,9 +440,9 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
411
440
|
}, {
|
|
412
441
|
key: "isBookingContextReady",
|
|
413
442
|
value: function isBookingContextReady() {
|
|
414
|
-
var _ref3, _params$date2;
|
|
443
|
+
var _this$otherParams2, _ref3, _params$date2;
|
|
415
444
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
416
|
-
var configKey =
|
|
445
|
+
var configKey = resolveBookingConfigRequest((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform, params.bookingConfigParams).key;
|
|
417
446
|
var dateInput = (_ref3 = (_params$date2 = params.date) !== null && _params$date2 !== void 0 ? _params$date2 : this.store.date) !== null && _ref3 !== void 0 ? _ref3 : dayjs();
|
|
418
447
|
var queryDate = toScheduleQueryDate(dateInput);
|
|
419
448
|
var resourcesKey = buildBookingResourcesQueryKey({
|
|
@@ -428,7 +457,7 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
428
457
|
key: "initBookingContext",
|
|
429
458
|
value: function () {
|
|
430
459
|
var _initBookingContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
431
|
-
var _ref4, _params$date3;
|
|
460
|
+
var _ref4, _params$date3, _this$otherParams3;
|
|
432
461
|
var params,
|
|
433
462
|
dateInput,
|
|
434
463
|
queryDate,
|
|
@@ -450,7 +479,7 @@ export var BookingContextModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
450
479
|
}
|
|
451
480
|
return _context6.abrupt("return", this.getState());
|
|
452
481
|
case 6:
|
|
453
|
-
configKey =
|
|
482
|
+
configKey = resolveBookingConfigRequest((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.platform, params.bookingConfigParams).key;
|
|
454
483
|
resourcesKey = buildBookingResourcesQueryKey({
|
|
455
484
|
date: queryDate,
|
|
456
485
|
bookingIds: params.bookingIds
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* BookingContext 子模块:承载「预约 UI 上下文」三件套。
|
|
3
3
|
*
|
|
4
|
-
* - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
|
|
4
|
+
* - bookingConfig:来自 staff `/core/board/management/config` 或 H5 `/core/board/config` 的整套预约配置(service_time / resource_tab /
|
|
5
5
|
* appointment_subject / subject_require / stock_setting / basic / capacity 等)。
|
|
6
6
|
* - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
|
|
7
7
|
* combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
|
|
12
12
|
* - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
|
|
13
13
|
*/
|
|
14
|
-
/** `loadBookingConfig`
|
|
14
|
+
/** `loadBookingConfig` 入参;H5 公共接口只消费 `item_type`。 */
|
|
15
15
|
export interface LoadBookingConfigParams {
|
|
16
16
|
item_type?: string;
|
|
17
17
|
sub_type?: string;
|
|
@@ -42,7 +42,7 @@ export interface InitBookingContextParams {
|
|
|
42
42
|
export type BookingContextResource = Record<string, any>;
|
|
43
43
|
export type BookingContextResourceMap = Record<string, BookingContextResource>;
|
|
44
44
|
/**
|
|
45
|
-
* 形参 booking_config(结构来自
|
|
45
|
+
* 形参 booking_config(结构来自 staff management 或 H5 board config 接口的 `data`)。
|
|
46
46
|
* OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
|
|
47
47
|
*/
|
|
48
48
|
export type BookingContextConfig = Record<string, any>;
|
|
@@ -80,7 +80,7 @@ export interface BookingContextModuleAPI {
|
|
|
80
80
|
getState(): BookingContextState;
|
|
81
81
|
/** 一键清空,destroy / 切租户场景用。 */
|
|
82
82
|
clear(): void;
|
|
83
|
-
/**
|
|
83
|
+
/** 按运行平台拉取 board config 并写入 store。 */
|
|
84
84
|
loadBookingConfig(params?: LoadBookingConfigParams): Promise<BookingContextConfig | null>;
|
|
85
85
|
/** 拉取资源全集并写入 store(`/schedule/resource/list`)。 */
|
|
86
86
|
loadResources(params?: LoadBookingResourcesParams): Promise<BookingContextResource[]>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* BookingContext 子模块:承载「预约 UI 上下文」三件套。
|
|
3
3
|
*
|
|
4
|
-
* - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
|
|
4
|
+
* - bookingConfig:来自 staff `/core/board/management/config` 或 H5 `/core/board/config` 的整套预约配置(service_time / resource_tab /
|
|
5
5
|
* appointment_subject / subject_require / stock_setting / basic / capacity 等)。
|
|
6
6
|
* - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
|
|
7
7
|
* combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
/** `loadBookingConfig`
|
|
15
|
+
/** `loadBookingConfig` 入参;H5 公共接口只消费 `item_type`。 */
|
|
16
16
|
|
|
17
17
|
/** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* 形参 booking_config(结构来自
|
|
27
|
+
* 形参 booking_config(结构来自 staff management 或 H5 board config 接口的 `data`)。
|
|
28
28
|
* OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
|
|
29
29
|
*/
|
|
30
30
|
|
|
@@ -192,10 +192,11 @@ function synthesizeProductResourceFromBooking(booking) {
|
|
|
192
192
|
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
193
193
|
*/
|
|
194
194
|
export function buildCacheItemFromOrderLine(input) {
|
|
195
|
-
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$bundle_edit, _product$product_vari, _product$num,
|
|
195
|
+
var _ref11, _sourceProduct$holder, _sourceProduct$origin, _product$metadata, _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$bundle_edit, _product$product_vari, _product$num, _ref12, _product$note, _booking$detail2, _product$metadata2, _product$metadata3, _ref13, _extension_type, _booking$product2, _booking$product3, _price, _product$product_sku, _product$order_detail, _ref14, _booking$id;
|
|
196
196
|
var product = input.product,
|
|
197
197
|
booking = input.booking,
|
|
198
198
|
sourceProduct = input.sourceProduct;
|
|
199
|
+
var holderConfig = (_ref11 = (_sourceProduct$holder = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.holder_config) !== null && _sourceProduct$holder !== void 0 ? _sourceProduct$holder : sourceProduct === null || sourceProduct === void 0 || (_sourceProduct$origin = sourceProduct.origin) === null || _sourceProduct$origin === void 0 ? void 0 : _sourceProduct$origin.holder_config) !== null && _ref11 !== void 0 ? _ref11 : (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.holder_config;
|
|
199
200
|
var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
|
|
200
201
|
var selling = Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
201
202
|
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
@@ -229,7 +230,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
229
230
|
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
|
|
230
231
|
product_name: productTitle,
|
|
231
232
|
product_cover: productCover,
|
|
232
|
-
note: (
|
|
233
|
+
note: (_ref12 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref12 !== void 0 ? _ref12 : '',
|
|
233
234
|
price: mainProductPrice,
|
|
234
235
|
total: selling,
|
|
235
236
|
origin_total: original,
|
|
@@ -238,7 +239,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
238
239
|
holder_id: holderId,
|
|
239
240
|
other: other,
|
|
240
241
|
like_status: booking.like_status || 'common',
|
|
241
|
-
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$
|
|
242
|
+
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.product_discount_reason) || undefined
|
|
242
243
|
}, bundleEdit !== undefined ? {
|
|
243
244
|
bundle_edit: bundleEdit
|
|
244
245
|
} : {}), productOptionString ? {
|
|
@@ -254,7 +255,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
254
255
|
extend.origin_total = selling + manualAmount;
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
|
-
if (((_product$
|
|
258
|
+
if (((_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.price_override) != null || manualDiscount) {
|
|
258
259
|
extend.priceOverride = selling;
|
|
259
260
|
}
|
|
260
261
|
if (booking.holder !== undefined) {
|
|
@@ -263,10 +264,12 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
263
264
|
if (Array.isArray(booking.relation_forms)) {
|
|
264
265
|
extend.relation_forms = booking.relation_forms;
|
|
265
266
|
}
|
|
266
|
-
var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}),
|
|
267
|
+
var base = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), holderConfig !== undefined && holderConfig !== null ? {
|
|
268
|
+
holder_config: holderConfig
|
|
269
|
+
} : {}), {}, {
|
|
267
270
|
id: resolvedId,
|
|
268
271
|
product_id: resolvedId,
|
|
269
|
-
extension_type: (
|
|
272
|
+
extension_type: (_ref13 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref13 !== void 0 ? _ref13 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
|
|
270
273
|
title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
|
|
271
274
|
price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
|
|
272
275
|
selling_price: product.selling_price,
|
|
@@ -280,7 +283,7 @@ export function buildCacheItemFromOrderLine(input) {
|
|
|
280
283
|
new: 0,
|
|
281
284
|
autoClose: false,
|
|
282
285
|
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
283
|
-
booking_id: (
|
|
286
|
+
booking_id: (_ref14 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref14 !== void 0 ? _ref14 : 0
|
|
284
287
|
});
|
|
285
288
|
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
|
|
286
289
|
base.capacity = sourceProduct.capacity;
|
|
@@ -28,6 +28,7 @@ export declare class OpenDataModule extends BaseModule implements Module {
|
|
|
28
28
|
* openDataModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' })
|
|
29
29
|
*/
|
|
30
30
|
updateOtherParams(params: Record<string, any>): void;
|
|
31
|
+
private shouldSkipInvoiceTemplateDocument;
|
|
31
32
|
fetchOpenData(params: OpenDataFetchParams): Promise<OpenDataConfig>;
|
|
32
33
|
getOpenData(): OpenDataConfig | null;
|
|
33
34
|
getInvoiceLayoutConfig(): InvoiceLayoutConfig;
|
|
@@ -128,6 +128,12 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
128
128
|
this.cacheId = this.otherParams.cacheId;
|
|
129
129
|
this.fatherModule = this.otherParams.fatherModule;
|
|
130
130
|
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "shouldSkipInvoiceTemplateDocument",
|
|
133
|
+
value: function shouldSkipInvoiceTemplateDocument() {
|
|
134
|
+
var _this$otherParams;
|
|
135
|
+
return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase() === 'h5';
|
|
136
|
+
}
|
|
131
137
|
}, {
|
|
132
138
|
key: "fetchOpenData",
|
|
133
139
|
value: function () {
|
|
@@ -205,6 +211,9 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
205
211
|
key: "getInvoiceTemplateSettings",
|
|
206
212
|
value: function getInvoiceTemplateSettings() {
|
|
207
213
|
var _this$store$data2;
|
|
214
|
+
if (this.shouldSkipInvoiceTemplateDocument()) {
|
|
215
|
+
return getDefaultInvoiceTemplateSettings();
|
|
216
|
+
}
|
|
208
217
|
if (isRecord(this.store.invoiceTemplateSettings)) {
|
|
209
218
|
var _this$store$data;
|
|
210
219
|
var documentId = resolveInvoiceDocumentId((_this$store$data = this.store.data) === null || _this$store$data === void 0 ? void 0 : _this$store$data['documents.invoice_template']);
|
|
@@ -278,10 +287,20 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
278
287
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
279
288
|
while (1) switch (_context4.prev = _context4.next) {
|
|
280
289
|
case 0:
|
|
290
|
+
if (!this.shouldSkipInvoiceTemplateDocument()) {
|
|
291
|
+
_context4.next = 2;
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
return _context4.abrupt("return", {
|
|
295
|
+
settings: getDefaultInvoiceTemplateSettings(),
|
|
296
|
+
documentId: null,
|
|
297
|
+
cacheKey: null
|
|
298
|
+
});
|
|
299
|
+
case 2:
|
|
281
300
|
rawTemplate = config['documents.invoice_template'];
|
|
282
301
|
documentId = resolveInvoiceDocumentId(rawTemplate);
|
|
283
302
|
if (documentId) {
|
|
284
|
-
_context4.next =
|
|
303
|
+
_context4.next = 6;
|
|
285
304
|
break;
|
|
286
305
|
}
|
|
287
306
|
return _context4.abrupt("return", {
|
|
@@ -289,10 +308,10 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
289
308
|
documentId: null,
|
|
290
309
|
cacheKey: null
|
|
291
310
|
});
|
|
292
|
-
case
|
|
311
|
+
case 6:
|
|
293
312
|
cacheKey = this.buildInvoiceTemplateCacheKey(target, documentId);
|
|
294
313
|
if (!(this.store.invoiceTemplateTarget === target && this.store.invoiceTemplateDocumentId === documentId && this.store.invoiceTemplateCacheKey === cacheKey && isRecord(this.store.invoiceTemplateSettings))) {
|
|
295
|
-
_context4.next =
|
|
314
|
+
_context4.next = 9;
|
|
296
315
|
break;
|
|
297
316
|
}
|
|
298
317
|
return _context4.abrupt("return", {
|
|
@@ -300,10 +319,10 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
300
319
|
documentId: documentId,
|
|
301
320
|
cacheKey: cacheKey
|
|
302
321
|
});
|
|
303
|
-
case
|
|
322
|
+
case 9:
|
|
304
323
|
cachedSettings = this.invoiceTemplateDocumentCache.get(cacheKey);
|
|
305
324
|
if (!cachedSettings) {
|
|
306
|
-
_context4.next =
|
|
325
|
+
_context4.next = 12;
|
|
307
326
|
break;
|
|
308
327
|
}
|
|
309
328
|
return _context4.abrupt("return", {
|
|
@@ -311,7 +330,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
311
330
|
documentId: documentId,
|
|
312
331
|
cacheKey: cacheKey
|
|
313
332
|
});
|
|
314
|
-
case
|
|
333
|
+
case 12:
|
|
315
334
|
request = this.invoiceTemplateDocumentInFlight.get(cacheKey);
|
|
316
335
|
if (!request) {
|
|
317
336
|
cacheRevision = this.invoiceTemplateCacheRevision;
|
|
@@ -331,9 +350,9 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
331
350
|
});
|
|
332
351
|
this.invoiceTemplateDocumentInFlight.set(cacheKey, request);
|
|
333
352
|
}
|
|
334
|
-
_context4.next =
|
|
353
|
+
_context4.next = 16;
|
|
335
354
|
return request;
|
|
336
|
-
case
|
|
355
|
+
case 16:
|
|
337
356
|
_context4.t0 = _context4.sent;
|
|
338
357
|
_context4.t1 = documentId;
|
|
339
358
|
_context4.t2 = cacheKey;
|
|
@@ -342,7 +361,7 @@ export var OpenDataModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
342
361
|
documentId: _context4.t1,
|
|
343
362
|
cacheKey: _context4.t2
|
|
344
363
|
});
|
|
345
|
-
case
|
|
364
|
+
case 20:
|
|
346
365
|
case "end":
|
|
347
366
|
return _context4.stop();
|
|
348
367
|
}
|
|
@@ -415,6 +415,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
415
415
|
* if (pending) await pending;
|
|
416
416
|
*/
|
|
417
417
|
private appendProductLineToTempOrder;
|
|
418
|
+
/**
|
|
419
|
+
* booking 数量拆行时,若 Holder 数量与拆行数严格一致,则按下标分配。
|
|
420
|
+
* 数量不一致时保持旧数据,避免猜测 Holder 与商品份数的对应关系。
|
|
421
|
+
*/
|
|
422
|
+
private createSplitBookingLine;
|
|
418
423
|
/**
|
|
419
424
|
* 添加商品行。带 booking 时强制独立行;num>1 时拆成多条 num=1 的 product+booking(对齐 BookingByStep / ticketBooking addService)。
|
|
420
425
|
*
|