@pisell/pisellos 1.0.49 → 1.0.50
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.js +2 -1
- package/dist/effects/index.d.ts +4 -3
- package/dist/effects/index.js +15 -6
- package/dist/modules/AccountList/index.d.ts +7 -1
- package/dist/modules/AccountList/index.js +81 -14
- package/dist/modules/AccountList/types.d.ts +28 -0
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/Customer/constants.d.ts +7 -0
- package/dist/modules/Customer/constants.js +12 -0
- package/dist/modules/Customer/index.d.ts +122 -0
- package/dist/modules/Customer/index.js +697 -0
- package/dist/modules/Customer/types.d.ts +146 -0
- package/dist/modules/Customer/types.js +41 -0
- package/dist/modules/ProductList/index.d.ts +12 -1
- package/dist/modules/ProductList/index.js +28 -4
- package/dist/modules/Rules/index.js +7 -5
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingTicket/index.d.ts +160 -0
- package/dist/solution/BookingTicket/index.js +640 -0
- package/dist/solution/BookingTicket/types.d.ts +68 -0
- package/dist/solution/BookingTicket/types.js +43 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +19 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +182 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +59 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +201 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
- package/dist/solution/ShopDiscount/index.js +4 -2
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +1 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/utils/task.d.ts +31 -0
- package/dist/utils/task.js +150 -0
- package/dist/utils/watch.d.ts +102 -0
- package/dist/utils/watch.js +294 -0
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +4 -3
- package/lib/effects/index.js +4 -1
- package/lib/modules/AccountList/index.d.ts +7 -1
- package/lib/modules/AccountList/index.js +27 -0
- package/lib/modules/AccountList/types.d.ts +28 -0
- package/lib/modules/Customer/constants.d.ts +7 -0
- package/lib/modules/Customer/constants.js +39 -0
- package/lib/modules/Customer/index.d.ts +122 -0
- package/lib/modules/Customer/index.js +440 -0
- package/lib/modules/Customer/types.d.ts +146 -0
- package/lib/modules/Customer/types.js +37 -0
- package/lib/modules/ProductList/index.d.ts +12 -1
- package/lib/modules/ProductList/index.js +30 -3
- package/lib/modules/Rules/index.js +4 -3
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -0
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingTicket/index.d.ts +160 -0
- package/lib/solution/BookingTicket/index.js +381 -0
- package/lib/solution/BookingTicket/types.d.ts +68 -0
- package/lib/solution/BookingTicket/types.js +72 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +19 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +137 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +59 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +149 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +2 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/utils/task.d.ts +31 -0
- package/lib/utils/task.js +84 -0
- package/lib/utils/watch.d.ts +102 -0
- package/lib/utils/watch.js +217 -0
- package/package.json +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { ICustomer } from "../AccountList/types";
|
|
2
|
+
export declare enum CustomerHooks {
|
|
3
|
+
OnCustomerListUpdate = "customer:onUpdate",
|
|
4
|
+
OnCustomerListError = "customer:onError",
|
|
5
|
+
OnCustomerSelected = "customer:onSelected",
|
|
6
|
+
OnPaginationChange = "customer:onPaginationChange",
|
|
7
|
+
OnScrollLoadMore = "customer:onScrollLoadMore",
|
|
8
|
+
OnScrollLoadComplete = "customer:onScrollLoadComplete"
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 客户数据
|
|
12
|
+
*/
|
|
13
|
+
export interface ShopCustomer extends ICustomer {
|
|
14
|
+
/** 客户ID */
|
|
15
|
+
id: string | number;
|
|
16
|
+
/** 客户姓名 */
|
|
17
|
+
name: string;
|
|
18
|
+
/** 客户电话 */
|
|
19
|
+
phone?: string;
|
|
20
|
+
/** 客户邮箱 */
|
|
21
|
+
email?: string;
|
|
22
|
+
/** 客户创建时间 */
|
|
23
|
+
created_at?: string;
|
|
24
|
+
/** 客户更新时间 */
|
|
25
|
+
updated_at?: string;
|
|
26
|
+
/** 其他客户信息 */
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 客户列表关联查询参数
|
|
31
|
+
*
|
|
32
|
+
* formRecord: 用户表单记录
|
|
33
|
+
* walletDetails.wallet: 用户所有wallet
|
|
34
|
+
* latestWalletDetail.wallet: 用户最新wallet
|
|
35
|
+
*/
|
|
36
|
+
type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
|
|
37
|
+
/**
|
|
38
|
+
* 获取客户列表参数
|
|
39
|
+
*/
|
|
40
|
+
export interface ShopGetCustomerListParams {
|
|
41
|
+
/** 页码 */
|
|
42
|
+
skip?: number;
|
|
43
|
+
/** 每页数量 */
|
|
44
|
+
num?: number;
|
|
45
|
+
/** 搜索关键词 */
|
|
46
|
+
search?: string;
|
|
47
|
+
/** 关联查询参数 */
|
|
48
|
+
with?: CustomerWith[];
|
|
49
|
+
/** wallet搜索标识 */
|
|
50
|
+
search_wallet_flag?: 0 | 1;
|
|
51
|
+
/** wallet pass搜索标识 */
|
|
52
|
+
search_wallet_pass_flag?: 0 | 1;
|
|
53
|
+
/** 其他筛选参数 */
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* 分页信息
|
|
58
|
+
*/
|
|
59
|
+
export interface IPaginationInfo {
|
|
60
|
+
/** 当前页码 */
|
|
61
|
+
page: number;
|
|
62
|
+
/** 每页数量 */
|
|
63
|
+
pageSize: number;
|
|
64
|
+
/** 总数 */
|
|
65
|
+
total: number;
|
|
66
|
+
/** 总页数 */
|
|
67
|
+
totalPages: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 客户列表响应
|
|
71
|
+
*/
|
|
72
|
+
export interface ICustomerListResponse {
|
|
73
|
+
/** 客户列表 */
|
|
74
|
+
list: ShopCustomer[];
|
|
75
|
+
/** 总数 */
|
|
76
|
+
total: number;
|
|
77
|
+
/** 当前页 */
|
|
78
|
+
page?: number;
|
|
79
|
+
/** 每页数量 */
|
|
80
|
+
pageSize?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 客户列表状态
|
|
84
|
+
*/
|
|
85
|
+
export interface CustomerState {
|
|
86
|
+
/** 客户列表 */
|
|
87
|
+
customerList: ShopCustomer[];
|
|
88
|
+
/** 当前选择的客户 */
|
|
89
|
+
selectedCustomer: ShopCustomer | null;
|
|
90
|
+
/** 列表总数 */
|
|
91
|
+
total: number;
|
|
92
|
+
/** 当前页码 */
|
|
93
|
+
currentPage: number;
|
|
94
|
+
/** 每页数量 */
|
|
95
|
+
pageSize: number;
|
|
96
|
+
/** 加载状态 */
|
|
97
|
+
loading: boolean;
|
|
98
|
+
/** 错误信息 */
|
|
99
|
+
error: string | null;
|
|
100
|
+
/** 是否支持滚动加载更多 */
|
|
101
|
+
hasMore: boolean;
|
|
102
|
+
/** 滚动加载状态 */
|
|
103
|
+
loadingMore: boolean;
|
|
104
|
+
/** 当前搜索条件 */
|
|
105
|
+
searchParams: Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 客户模块 API
|
|
109
|
+
*/
|
|
110
|
+
export interface CustomerModuleAPI {
|
|
111
|
+
/** 获取客户列表 */
|
|
112
|
+
getCustomerList: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
113
|
+
/** 设置客户列表 */
|
|
114
|
+
setCustomerList: (customers: ShopCustomer[], total?: number) => void;
|
|
115
|
+
/** 设置当前选择的客户 */
|
|
116
|
+
setSelectedCustomer: (customer: ShopCustomer | null) => void;
|
|
117
|
+
/** 获取当前选择的客户 */
|
|
118
|
+
getSelectedCustomer: () => ShopCustomer | null;
|
|
119
|
+
/** 获取客户列表 */
|
|
120
|
+
getCustomers: () => ShopCustomer[];
|
|
121
|
+
/** 根据ID查找客户 */
|
|
122
|
+
getCustomerById: (id: string | number) => ShopCustomer | null;
|
|
123
|
+
/** 清空客户列表 */
|
|
124
|
+
clearCustomers: () => void;
|
|
125
|
+
/** 添加客户到列表第一位 */
|
|
126
|
+
addCustomerToFirst: (customer: ShopCustomer) => void;
|
|
127
|
+
/** 获取当前状态 */
|
|
128
|
+
getState: () => CustomerState;
|
|
129
|
+
/** 获取分页信息 */
|
|
130
|
+
getPaginationInfo: () => IPaginationInfo;
|
|
131
|
+
/** 触发分页变化事件 */
|
|
132
|
+
triggerPaginationChange: (pagination: IPaginationInfo) => void;
|
|
133
|
+
/** 设置分页信息 */
|
|
134
|
+
setPaginationInfo: (page: number, pageSize: number) => void;
|
|
135
|
+
/** 便捷方法:切换分页并自动获取数据 */
|
|
136
|
+
changeCustomerPage: (page: number, pageSize?: number) => Promise<ICustomerListResponse>;
|
|
137
|
+
/** 滚动加载更多客户数据 */
|
|
138
|
+
loadMoreCustomers: () => Promise<ICustomerListResponse>;
|
|
139
|
+
/** 重置并重新开始滚动加载 */
|
|
140
|
+
resetAndLoadCustomers: (params?: ShopGetCustomerListParams) => Promise<ICustomerListResponse>;
|
|
141
|
+
/** 检查是否还有更多数据可以加载 */
|
|
142
|
+
hasMoreCustomers: () => boolean;
|
|
143
|
+
/** 获取当前的搜索条件 */
|
|
144
|
+
getCurrentSearchParams: () => Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
145
|
+
}
|
|
146
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export var CustomerHooks = /*#__PURE__*/function (CustomerHooks) {
|
|
2
|
+
CustomerHooks["OnCustomerListUpdate"] = "customer:onUpdate";
|
|
3
|
+
CustomerHooks["OnCustomerListError"] = "customer:onError";
|
|
4
|
+
CustomerHooks["OnCustomerSelected"] = "customer:onSelected";
|
|
5
|
+
CustomerHooks["OnPaginationChange"] = "customer:onPaginationChange";
|
|
6
|
+
CustomerHooks["OnScrollLoadMore"] = "customer:onScrollLoadMore";
|
|
7
|
+
CustomerHooks["OnScrollLoadComplete"] = "customer:onScrollLoadComplete";
|
|
8
|
+
return CustomerHooks;
|
|
9
|
+
}({});
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 客户数据
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 客户列表关联查询参数
|
|
17
|
+
*
|
|
18
|
+
* formRecord: 用户表单记录
|
|
19
|
+
* walletDetails.wallet: 用户所有wallet
|
|
20
|
+
* latestWalletDetail.wallet: 用户最新wallet
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 获取客户列表参数
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 分页信息
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 客户列表响应
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 客户列表状态
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 客户模块 API
|
|
41
|
+
*/
|
|
@@ -11,12 +11,17 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
11
11
|
constructor(name?: string, version?: string);
|
|
12
12
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
13
13
|
storeChange(path?: string, value?: any): Promise<void>;
|
|
14
|
-
loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
|
|
14
|
+
loadProducts({ category_ids, product_ids, collection, menu_list_ids, customer_id: paramsCustomerId, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, }: {
|
|
15
15
|
category_ids?: number[];
|
|
16
16
|
product_ids?: number[];
|
|
17
17
|
collection?: number | string[];
|
|
18
18
|
schedule_date?: string;
|
|
19
19
|
cacheId?: string;
|
|
20
|
+
customer_id?: number;
|
|
21
|
+
menu_list_ids?: number[];
|
|
22
|
+
schedule_datetime?: string;
|
|
23
|
+
with_count?: string[];
|
|
24
|
+
with_schedule?: number;
|
|
20
25
|
}): Promise<any>;
|
|
21
26
|
loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
|
|
22
27
|
ids?: number[];
|
|
@@ -28,4 +33,10 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
28
33
|
getProduct(id: number): Promise<Product | undefined>;
|
|
29
34
|
addProduct(products: ProductData[]): Promise<void>;
|
|
30
35
|
selectProducts(products: ProductData[]): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* 根据商品编码或条码搜索商品
|
|
38
|
+
* @param code 商品编码或条码
|
|
39
|
+
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
40
|
+
*/
|
|
41
|
+
findProductsByCodeOrBarcode(code: string): ProductData[];
|
|
31
42
|
}
|
|
@@ -100,11 +100,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
100
100
|
key: "loadProducts",
|
|
101
101
|
value: function () {
|
|
102
102
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
103
|
-
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, schedule_date, cacheId, userPlugin, customer_id, _userPlugin$get, productsData;
|
|
103
|
+
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, productsData;
|
|
104
104
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
105
105
|
while (1) switch (_context3.prev = _context3.next) {
|
|
106
106
|
case 0:
|
|
107
|
-
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId;
|
|
107
|
+
_ref$category_ids = _ref.category_ids, category_ids = _ref$category_ids === void 0 ? [] : _ref$category_ids, _ref$product_ids = _ref.product_ids, product_ids = _ref$product_ids === void 0 ? [] : _ref$product_ids, _ref$collection = _ref.collection, collection = _ref$collection === void 0 ? [] : _ref$collection, _ref$menu_list_ids = _ref.menu_list_ids, menu_list_ids = _ref$menu_list_ids === void 0 ? [] : _ref$menu_list_ids, paramsCustomerId = _ref.customer_id, _ref$with_count = _ref.with_count, with_count = _ref$with_count === void 0 ? [] : _ref$with_count, schedule_datetime = _ref.schedule_datetime, schedule_date = _ref.schedule_date, cacheId = _ref.cacheId, with_schedule = _ref.with_schedule;
|
|
108
108
|
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
109
109
|
// if (!schedule_ids?.length) {
|
|
110
110
|
// const schedule_ids_data = this.store.schedule
|
|
@@ -120,7 +120,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
120
120
|
userPlugin = this.core.getPlugin('user');
|
|
121
121
|
customer_id = undefined;
|
|
122
122
|
try {
|
|
123
|
-
customer_id = userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id;
|
|
123
|
+
customer_id = paramsCustomerId || (userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get()) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id);
|
|
124
124
|
} catch (error) {
|
|
125
125
|
console.error(error);
|
|
126
126
|
}
|
|
@@ -139,8 +139,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
139
139
|
ids: product_ids,
|
|
140
140
|
collection: collection,
|
|
141
141
|
front_end_cache_id: cacheId,
|
|
142
|
+
menu_list_ids: menu_list_ids,
|
|
143
|
+
with_count: with_count,
|
|
142
144
|
// client_schedule_ids: schedule_ids,
|
|
143
|
-
schedule_date: schedule_date
|
|
145
|
+
schedule_date: schedule_date,
|
|
146
|
+
with_schedule: with_schedule,
|
|
147
|
+
schedule_datetime: schedule_datetime
|
|
144
148
|
}, {
|
|
145
149
|
useCache: true
|
|
146
150
|
});
|
|
@@ -297,6 +301,26 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
297
301
|
}
|
|
298
302
|
return selectProducts;
|
|
299
303
|
}()
|
|
304
|
+
/**
|
|
305
|
+
* 根据商品编码或条码搜索商品
|
|
306
|
+
* @param code 商品编码或条码
|
|
307
|
+
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
308
|
+
*/
|
|
309
|
+
}, {
|
|
310
|
+
key: "findProductsByCodeOrBarcode",
|
|
311
|
+
value: function findProductsByCodeOrBarcode(code) {
|
|
312
|
+
if (!code || typeof code !== 'string') {
|
|
313
|
+
return [];
|
|
314
|
+
}
|
|
315
|
+
var trimmedCode = code.trim();
|
|
316
|
+
if (!trimmedCode) {
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
var matchingProducts = this.store.list.filter(function (product) {
|
|
320
|
+
return product.code && product.code.trim() === trimmedCode || product.barcode && product.barcode.trim() === trimmedCode;
|
|
321
|
+
});
|
|
322
|
+
return cloneDeep(matchingProducts);
|
|
323
|
+
}
|
|
300
324
|
}]);
|
|
301
325
|
return ProductList;
|
|
302
326
|
}(BaseModule);
|
|
@@ -28,6 +28,7 @@ import { RulesHooks } from "./types";
|
|
|
28
28
|
import { uniqueById } from "../../solution/ShopDiscount/utils";
|
|
29
29
|
import { getProductOriginTotalPrice, getProductTotalPrice } from "../Cart/utils";
|
|
30
30
|
import Decimal from 'decimal.js';
|
|
31
|
+
import { isBoolean } from 'lodash-es';
|
|
31
32
|
export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
32
33
|
_inherits(RulesModule, _BaseModule);
|
|
33
34
|
var _super = _createSuper(RulesModule);
|
|
@@ -330,10 +331,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
330
331
|
var applicableDiscounts = sortedDiscountList.filter(function (discount) {
|
|
331
332
|
var _product$discount_lis6;
|
|
332
333
|
// 如果商品价格为 0,其实不需要使用任何优惠券,直接 return true
|
|
333
|
-
//
|
|
334
|
-
if ((Number(product.price)
|
|
335
|
-
//
|
|
336
|
-
if ((Number(product.total)
|
|
334
|
+
// 商品券时主商品价格小于等于0不可用
|
|
335
|
+
if ((Number(product.price) <= 0 || !product.price) && (discount.tag || discount.type) === 'good_pass') return false;
|
|
336
|
+
// 折扣卡时总价小于等于0时不可用
|
|
337
|
+
if ((Number(product.total) <= 0 || !product.total) && !((_product$discount_lis6 = product.discount_list) !== null && _product$discount_lis6 !== void 0 && _product$discount_lis6.find(function (n) {
|
|
337
338
|
var _n$discount;
|
|
338
339
|
return ((_n$discount = n.discount) === null || _n$discount === void 0 ? void 0 : _n$discount.resource_id) === discount.id;
|
|
339
340
|
})) && (discount.tag || discount.type) !== 'good_pass') return false;
|
|
@@ -373,7 +374,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
373
374
|
}
|
|
374
375
|
|
|
375
376
|
// 如果没有适用的优惠券,或者手动折扣,则不适用优惠券
|
|
376
|
-
|
|
377
|
+
// 自定义商品:如果未开启适用折扣卡(product.vouchersApplicable),则不适用优惠券
|
|
378
|
+
if (applicableDiscounts.length === 0 || isManualDiscount || isBoolean(product.vouchersApplicable) && !product.vouchersApplicable) {
|
|
377
379
|
if (product.isClient) {
|
|
378
380
|
processedProductsMap.set(product._id, [_this3.hooks.setProduct(originProduct, _objectSpread(_objectSpread({}, isManualDiscount ? {} : {
|
|
379
381
|
origin_total: getProductOriginTotalPrice({
|
package/dist/modules/index.d.ts
CHANGED
package/dist/modules/index.js
CHANGED
package/dist/plugins/window.d.ts
CHANGED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { Module, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../../modules/BaseModule';
|
|
3
|
+
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
4
|
+
import { IGetCustomerListParams, ICustomer, ILoadProductsParams, IScanResult } from './types';
|
|
5
|
+
import { ProductData } from '../../modules';
|
|
6
|
+
export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
7
|
+
protected defaultName: string;
|
|
8
|
+
protected defaultVersion: string;
|
|
9
|
+
isSolution: boolean;
|
|
10
|
+
request: RequestPlugin;
|
|
11
|
+
window: WindowPlugin;
|
|
12
|
+
private shopStore;
|
|
13
|
+
private store;
|
|
14
|
+
private otherParams;
|
|
15
|
+
private cacheId;
|
|
16
|
+
private platform;
|
|
17
|
+
private scan;
|
|
18
|
+
initialize(core: PisellCore, options: any): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* 获取商品列表
|
|
21
|
+
* @param params 包含 schedule_date 的参数
|
|
22
|
+
* @returns 商品列表
|
|
23
|
+
*/
|
|
24
|
+
loadProducts(params?: ILoadProductsParams): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* 获取商品列表(不加载到模块中)
|
|
27
|
+
* @returns 商品列表
|
|
28
|
+
*/
|
|
29
|
+
getProducts(): Promise<ProductData[]>;
|
|
30
|
+
/**
|
|
31
|
+
* 获取客户列表
|
|
32
|
+
* @param params 查询参数
|
|
33
|
+
* @returns 客户列表响应
|
|
34
|
+
*/
|
|
35
|
+
getCustomerList(params?: IGetCustomerListParams): Promise<import("../../modules").ICustomerListResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* 设置活跃客户
|
|
38
|
+
* @param customer 客户信息
|
|
39
|
+
*/
|
|
40
|
+
setActiveCustomer(customer: ICustomer): void;
|
|
41
|
+
/**
|
|
42
|
+
* 获取当前活跃客户
|
|
43
|
+
* @returns 当前活跃客户
|
|
44
|
+
*/
|
|
45
|
+
getActiveCustomer(): ICustomer | null;
|
|
46
|
+
/**
|
|
47
|
+
* 根据ID设置选中的客户
|
|
48
|
+
* @param customerId 客户ID
|
|
49
|
+
*/
|
|
50
|
+
setSelectedCustomerById(customerId: string | number): void;
|
|
51
|
+
/**
|
|
52
|
+
* 获取所有客户
|
|
53
|
+
* @returns 客户列表
|
|
54
|
+
*/
|
|
55
|
+
getCustomers(): ICustomer[];
|
|
56
|
+
/**
|
|
57
|
+
* 根据ID获取客户
|
|
58
|
+
* @param customerId 客户ID
|
|
59
|
+
* @returns 客户信息
|
|
60
|
+
*/
|
|
61
|
+
getCustomerById(customerId: string | number): ICustomer | null;
|
|
62
|
+
/**
|
|
63
|
+
* 清空客户列表
|
|
64
|
+
*/
|
|
65
|
+
clearCustomers(): void;
|
|
66
|
+
/**
|
|
67
|
+
* 添加客户到列表第一位
|
|
68
|
+
* @param customer 要添加的客户信息
|
|
69
|
+
*/
|
|
70
|
+
addCustomerToFirst(customer: ICustomer): void;
|
|
71
|
+
/**
|
|
72
|
+
* 获取客户分页信息
|
|
73
|
+
* @returns 分页信息
|
|
74
|
+
*/
|
|
75
|
+
getCustomerPaginationInfo(): import("../../modules").IPaginationInfo;
|
|
76
|
+
/**
|
|
77
|
+
* 获取客户列表总数
|
|
78
|
+
* @returns 总数
|
|
79
|
+
*/
|
|
80
|
+
getCustomerTotal(): number;
|
|
81
|
+
/**
|
|
82
|
+
* 设置客户分页信息
|
|
83
|
+
* @param page 页码
|
|
84
|
+
* @param pageSize 每页数量
|
|
85
|
+
*/
|
|
86
|
+
setCustomerPaginationInfo(page: number, pageSize: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* 便捷方法:切换客户分页并自动获取数据
|
|
89
|
+
* @param page 页码
|
|
90
|
+
* @param pageSize 每页数量(可选)
|
|
91
|
+
* @returns 客户列表响应
|
|
92
|
+
*/
|
|
93
|
+
changeCustomerPage(page: number, pageSize?: number): Promise<import("../../modules").ICustomerListResponse>;
|
|
94
|
+
/**
|
|
95
|
+
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
96
|
+
* @returns 客户列表响应
|
|
97
|
+
*/
|
|
98
|
+
loadMoreCustomers(): Promise<import("../../modules").ICustomerListResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* 重置并重新开始滚动加载客户数据
|
|
101
|
+
* @param params 查询参数
|
|
102
|
+
* @returns 客户列表响应
|
|
103
|
+
*/
|
|
104
|
+
resetAndLoadCustomers(params?: IGetCustomerListParams): Promise<import("../../modules").ICustomerListResponse>;
|
|
105
|
+
/**
|
|
106
|
+
* 检查是否还有更多客户数据可以加载
|
|
107
|
+
* @returns 是否还有更多数据
|
|
108
|
+
*/
|
|
109
|
+
hasMoreCustomers(): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* 获取当前的客户搜索条件
|
|
112
|
+
* @returns 当前搜索条件
|
|
113
|
+
*/
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
115
|
+
/**
|
|
116
|
+
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
|
+
* @returns 客户状态
|
|
118
|
+
*/
|
|
119
|
+
getCustomerState(): import("../../modules").CustomerState;
|
|
120
|
+
/**
|
|
121
|
+
* 全局扫描监听
|
|
122
|
+
* @param callback 回调
|
|
123
|
+
*/
|
|
124
|
+
scanGlobalListener(callback: (data: IScanResult) => void): {
|
|
125
|
+
remove: () => void;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* 客户扫描监听
|
|
129
|
+
* @param callback 回调
|
|
130
|
+
*/
|
|
131
|
+
scanCustomerListener(callback: (data: IScanResult) => void): {
|
|
132
|
+
remove: () => void;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* 调用摄像头
|
|
136
|
+
* @param data 用户自定义数据
|
|
137
|
+
*/
|
|
138
|
+
activateCamera(data?: {
|
|
139
|
+
[key: string]: any;
|
|
140
|
+
}): void;
|
|
141
|
+
/**
|
|
142
|
+
* 设置其他参数
|
|
143
|
+
* @param params 参数
|
|
144
|
+
* @param options 选项
|
|
145
|
+
*/
|
|
146
|
+
setOtherParams(params: Record<string, any>, { cover }?: {
|
|
147
|
+
cover?: boolean;
|
|
148
|
+
}): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* 获取其他参数
|
|
151
|
+
* @returns 其他参数
|
|
152
|
+
*/
|
|
153
|
+
getOtherParams(): Promise<Record<string, any>>;
|
|
154
|
+
/**
|
|
155
|
+
* 销毁模块
|
|
156
|
+
*/
|
|
157
|
+
destroy(): void;
|
|
158
|
+
}
|
|
159
|
+
export * from './types';
|
|
160
|
+
export { BookingTicketImpl as BookingTicket };
|