@pisell/pisellos 0.0.514 → 0.0.517
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/Discount/types.d.ts +1 -1
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Rules/index.js +9 -9
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingByStep/index.js +2 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +49 -0
- package/lib/modules/Discount/types.d.ts +1 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Rules/index.js +6 -6
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingByStep/index.js +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// 导出评估器
|
|
2
|
+
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
+
|
|
4
|
+
// 导出适配器
|
|
5
|
+
export { PromotionAdapter } from "./adapter";
|
|
6
|
+
export { default } from "./adapter";
|
|
7
|
+
|
|
8
|
+
// 导出策略配置示例常量
|
|
9
|
+
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -19,7 +19,7 @@ interface PackageSubItemUsageRules {
|
|
|
19
19
|
type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
|
|
20
20
|
rules: ("original_price" | "markup_price")[];
|
|
21
21
|
package_scope?: {
|
|
22
|
-
type: 'all_packages' | 'specific_packages';
|
|
22
|
+
type: 'all_packages' | 'specific_packages' | 'product_all' | 'products';
|
|
23
23
|
exclude_bundle_product_ids: number[];
|
|
24
24
|
include_bundle_product_ids: number[];
|
|
25
25
|
filter: 0 | 1;
|
|
@@ -82,7 +82,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
82
82
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
83
83
|
}): Promise<T>;
|
|
84
84
|
createOrder(params: CommitOrderParams['query']): {
|
|
85
|
-
type: "
|
|
85
|
+
type: "virtual" | "appointment_booking";
|
|
86
86
|
platform: string;
|
|
87
87
|
sales_channel: string;
|
|
88
88
|
order_sales_channel: string;
|
|
@@ -2368,12 +2368,12 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2368
2368
|
return true; // 单独购买时可用
|
|
2369
2369
|
}
|
|
2370
2370
|
if (isBundleItem) {
|
|
2371
|
-
var _flatItem$bundleItem9, _flatItem$bundleItem10, _flatItem$originProdu, _flatItem$
|
|
2371
|
+
var _flatItem$bundleItem9, _flatItem$bundleItem10, _flatItem$originProdu, _flatItem$parentProdu11;
|
|
2372
2372
|
// 套餐中购买时,判断是否为原价
|
|
2373
2373
|
var priceType = (_flatItem$bundleItem9 = flatItem.bundleItem) === null || _flatItem$bundleItem9 === void 0 ? void 0 : _flatItem$bundleItem9.price_type;
|
|
2374
2374
|
var priceTypeExt = (_flatItem$bundleItem10 = flatItem.bundleItem) === null || _flatItem$bundleItem10 === void 0 ? void 0 : _flatItem$bundleItem10.price_type_ext;
|
|
2375
2375
|
// 主商品id
|
|
2376
|
-
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.
|
|
2376
|
+
var mainProductId = (flatItem === null || flatItem === void 0 || (_flatItem$originProdu = flatItem.originProduct) === null || _flatItem$originProdu === void 0 || (_flatItem$originProdu = _flatItem$originProdu._productOrigin) === null || _flatItem$originProdu === void 0 ? void 0 : _flatItem$originProdu.id) || (flatItem === null || flatItem === void 0 || (_flatItem$parentProdu11 = flatItem.parentProduct) === null || _flatItem$parentProdu11 === void 0 ? void 0 : _flatItem$parentProdu11.id) || 0;
|
|
2377
2377
|
// original_price 对应:
|
|
2378
2378
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
2379
2379
|
// markup_price 对应:
|
|
@@ -2392,8 +2392,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2392
2392
|
// 套餐适用范围校验
|
|
2393
2393
|
var isScopeValid = false;
|
|
2394
2394
|
|
|
2395
|
-
//
|
|
2396
|
-
if (scopeType === 'all_packages') {
|
|
2395
|
+
// 排除套餐判断, product_all值兼容旧数据
|
|
2396
|
+
if (scopeType === 'all_packages' || scopeType === 'product_all') {
|
|
2397
2397
|
// 所有套餐可用
|
|
2398
2398
|
if (!filter) {
|
|
2399
2399
|
isScopeValid = true;
|
|
@@ -2402,8 +2402,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2402
2402
|
}
|
|
2403
2403
|
}
|
|
2404
2404
|
|
|
2405
|
-
//
|
|
2406
|
-
if (scopeType === 'specific_packages') {
|
|
2405
|
+
// 包含套餐判断, products值兼容旧数据
|
|
2406
|
+
if (scopeType === 'specific_packages' || scopeType === 'products') {
|
|
2407
2407
|
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
2408
2408
|
}
|
|
2409
2409
|
|
|
@@ -2438,10 +2438,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2438
2438
|
return false; // 单独购买时不可用
|
|
2439
2439
|
}
|
|
2440
2440
|
if (isBundleItem) {
|
|
2441
|
-
var _flatItem$
|
|
2441
|
+
var _flatItem$bundleItem11, _flatItem$bundleItem12;
|
|
2442
2442
|
// 套餐中购买时,判断是否为原价
|
|
2443
|
-
var _priceType = (_flatItem$
|
|
2444
|
-
var _priceTypeExt = (_flatItem$
|
|
2443
|
+
var _priceType = (_flatItem$bundleItem11 = flatItem.bundleItem) === null || _flatItem$bundleItem11 === void 0 ? void 0 : _flatItem$bundleItem11.price_type;
|
|
2444
|
+
var _priceTypeExt = (_flatItem$bundleItem12 = flatItem.bundleItem) === null || _flatItem$bundleItem12 === void 0 ? void 0 : _flatItem$bundleItem12.price_type_ext;
|
|
2445
2445
|
|
|
2446
2446
|
// original_price 对应:
|
|
2447
2447
|
// 1. price_type: "markup" && price_type_ext: "product_price"
|
|
@@ -302,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
302
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
303
|
errorList: any[];
|
|
304
304
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
305
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
306
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
307
|
resources_code: string;
|
|
308
308
|
startDate: string;
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 2 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -2073,6 +2073,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2073
2073
|
_cartItems$,
|
|
2074
2074
|
_cartItems$2,
|
|
2075
2075
|
_this$shopStore$get;
|
|
2076
|
+
var split = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
|
|
2076
2077
|
var dateRange = this.store.date.getDateRange();
|
|
2077
2078
|
// 取出购物车中所有一已选择的第一步资源
|
|
2078
2079
|
var resources = [];
|
|
@@ -2256,7 +2257,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2256
2257
|
resourcesMap: resourcesMap,
|
|
2257
2258
|
duration: duration,
|
|
2258
2259
|
currentDate: dateRange[0].date,
|
|
2259
|
-
split:
|
|
2260
|
+
split: split,
|
|
2260
2261
|
resourcesUseableMap: resourcesUseableMap,
|
|
2261
2262
|
capacity: maxCapacity,
|
|
2262
2263
|
cut_off_time: maxCutOffTime,
|
|
@@ -131,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
131
131
|
* 获取当前的客户搜索条件
|
|
132
132
|
* @returns 当前搜索条件
|
|
133
133
|
*/
|
|
134
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
134
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
135
135
|
/**
|
|
136
136
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
137
137
|
* @returns 客户状态
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
+
var promotion_exports = {};
|
|
31
|
+
__export(promotion_exports, {
|
|
32
|
+
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
+
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
+
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
+
default: () => import_adapter2.default
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
+
var import_evaluator = require("./evaluator");
|
|
40
|
+
var import_adapter = require("./adapter");
|
|
41
|
+
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
+
var import_examples = require("./examples");
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
+
PromotionAdapter,
|
|
47
|
+
PromotionEvaluator,
|
|
48
|
+
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
+
});
|
|
@@ -19,7 +19,7 @@ interface PackageSubItemUsageRules {
|
|
|
19
19
|
type: 'universal_discount' | 'package_exclusive' | 'single_item_promo' | 'custom_usage_rules';
|
|
20
20
|
rules: ("original_price" | "markup_price")[];
|
|
21
21
|
package_scope?: {
|
|
22
|
-
type: 'all_packages' | 'specific_packages';
|
|
22
|
+
type: 'all_packages' | 'specific_packages' | 'product_all' | 'products';
|
|
23
23
|
exclude_bundle_product_ids: number[];
|
|
24
24
|
include_bundle_product_ids: number[];
|
|
25
25
|
filter: 0 | 1;
|
|
@@ -82,7 +82,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
82
82
|
enhancePayload?: SubmitPayloadEnhancer;
|
|
83
83
|
}): Promise<T>;
|
|
84
84
|
createOrder(params: CommitOrderParams['query']): {
|
|
85
|
-
type: "
|
|
85
|
+
type: "virtual" | "appointment_booking";
|
|
86
86
|
platform: string;
|
|
87
87
|
sales_channel: string;
|
|
88
88
|
order_sales_channel: string;
|
|
@@ -1892,7 +1892,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1892
1892
|
* @returns 是否可用
|
|
1893
1893
|
*/
|
|
1894
1894
|
checkPackageSubItemUsageRules(discount, flatItem) {
|
|
1895
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1895
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1896
1896
|
const limitedData = discount.limited_relation_product_data;
|
|
1897
1897
|
const usageRules = limitedData == null ? void 0 : limitedData.package_sub_item_usage_rules;
|
|
1898
1898
|
const rules = ["original_price", ...(usageRules == null ? void 0 : usageRules.rules) || []];
|
|
@@ -1914,7 +1914,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1914
1914
|
if (isBundleItem) {
|
|
1915
1915
|
const priceType = (_a = flatItem.bundleItem) == null ? void 0 : _a.price_type;
|
|
1916
1916
|
const priceTypeExt = (_b = flatItem.bundleItem) == null ? void 0 : _b.price_type_ext;
|
|
1917
|
-
const mainProductId = ((_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c.
|
|
1917
|
+
const mainProductId = ((_d = (_c = flatItem == null ? void 0 : flatItem.originProduct) == null ? void 0 : _c._productOrigin) == null ? void 0 : _d.id) || ((_e = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _e.id) || 0;
|
|
1918
1918
|
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1919
1919
|
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1920
1920
|
if (rules.length > 0) {
|
|
@@ -1922,14 +1922,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1922
1922
|
const _isMarkupPrice = isMarkupPrice && rules.includes("markup_price");
|
|
1923
1923
|
const isPriceValid = _isOriginalPrice || _isMarkupPrice;
|
|
1924
1924
|
let isScopeValid = false;
|
|
1925
|
-
if (scopeType === "all_packages") {
|
|
1925
|
+
if (scopeType === "all_packages" || scopeType === "product_all") {
|
|
1926
1926
|
if (!filter) {
|
|
1927
1927
|
isScopeValid = true;
|
|
1928
1928
|
} else {
|
|
1929
1929
|
isScopeValid = !exclude_bundle_product_ids.includes(Number(mainProductId));
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
|
-
if (scopeType === "specific_packages") {
|
|
1932
|
+
if (scopeType === "specific_packages" || scopeType === "products") {
|
|
1933
1933
|
isScopeValid = include_bundle_product_ids.includes(Number(mainProductId));
|
|
1934
1934
|
}
|
|
1935
1935
|
if (isPriceValid && isScopeValid) {
|
|
@@ -1946,8 +1946,8 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
1946
1946
|
return false;
|
|
1947
1947
|
}
|
|
1948
1948
|
if (isBundleItem) {
|
|
1949
|
-
const priceType = (
|
|
1950
|
-
const priceTypeExt = (
|
|
1949
|
+
const priceType = (_f = flatItem.bundleItem) == null ? void 0 : _f.price_type;
|
|
1950
|
+
const priceTypeExt = (_g = flatItem.bundleItem) == null ? void 0 : _g.price_type_ext;
|
|
1951
1951
|
const isOriginalPrice = priceType === "markup" && priceTypeExt === "product_price";
|
|
1952
1952
|
const isMarkupPrice = priceType === "markup" && (priceTypeExt === "" || !priceTypeExt);
|
|
1953
1953
|
if (rules.length > 0) {
|
|
@@ -302,7 +302,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
302
302
|
autoSelectAllProductResources(resources_code: string, timeSlots?: TimeSliceItem): {
|
|
303
303
|
errorList: any[];
|
|
304
304
|
};
|
|
305
|
-
getTimeSlotByAllResources(resources_code: string): any[];
|
|
305
|
+
getTimeSlotByAllResources(resources_code: string, split?: number): any[];
|
|
306
306
|
getTimeSlotByAllResourcesForDate({ resources_code, startDate, endDate }: {
|
|
307
307
|
resources_code: string;
|
|
308
308
|
startDate: string;
|
|
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
311
311
|
date: string;
|
|
312
312
|
status: string;
|
|
313
313
|
week: string;
|
|
314
|
-
weekNum: 0 | 2 | 1 |
|
|
314
|
+
weekNum: 0 | 2 | 1 | 5 | 3 | 4 | 6;
|
|
315
315
|
}[]>;
|
|
316
316
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
317
317
|
private getScheduleDataByIds;
|
|
@@ -1409,7 +1409,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1409
1409
|
return { errorList };
|
|
1410
1410
|
}
|
|
1411
1411
|
// 从购物车中获取已经分配好第一步资源的所有时间片
|
|
1412
|
-
getTimeSlotByAllResources(resources_code) {
|
|
1412
|
+
getTimeSlotByAllResources(resources_code, split = 10) {
|
|
1413
1413
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1414
1414
|
let dateRange = this.store.date.getDateRange();
|
|
1415
1415
|
const resources = [];
|
|
@@ -1567,7 +1567,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
1567
1567
|
resourcesMap,
|
|
1568
1568
|
duration,
|
|
1569
1569
|
currentDate: dateRange[0].date,
|
|
1570
|
-
split
|
|
1570
|
+
split,
|
|
1571
1571
|
resourcesUseableMap,
|
|
1572
1572
|
capacity: maxCapacity,
|
|
1573
1573
|
cut_off_time: maxCutOffTime,
|
|
@@ -131,7 +131,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
131
131
|
* 获取当前的客户搜索条件
|
|
132
132
|
* @returns 当前搜索条件
|
|
133
133
|
*/
|
|
134
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
134
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
135
135
|
/**
|
|
136
136
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
137
137
|
* @returns 客户状态
|