@pisell/pisellos 2.0.67 → 2.1.1
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 +1 -2
- package/dist/effects/index.d.ts +3 -4
- package/dist/effects/index.js +6 -15
- package/dist/modules/AccountList/index.d.ts +1 -7
- package/dist/modules/AccountList/index.js +14 -81
- package/dist/modules/AccountList/types.d.ts +0 -28
- package/dist/modules/AccountList/types.js +0 -8
- package/dist/modules/ProductList/index.d.ts +2 -12
- package/dist/modules/ProductList/index.js +8 -28
- package/dist/modules/Rules/index.js +14 -27
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/index.d.ts +0 -1
- package/dist/modules/index.js +0 -1
- package/dist/plugins/window.d.ts +0 -1
- package/dist/solution/BookingByStep/utils/resources.js +12 -4
- package/dist/solution/ShopDiscount/index.js +2 -4
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +0 -1
- package/dist/types/index.d.ts +1 -3
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +3 -4
- package/lib/effects/index.js +1 -4
- package/lib/modules/AccountList/index.d.ts +1 -7
- package/lib/modules/AccountList/index.js +0 -27
- package/lib/modules/AccountList/types.d.ts +0 -28
- package/lib/modules/ProductList/index.d.ts +2 -12
- package/lib/modules/ProductList/index.js +6 -30
- package/lib/modules/Rules/index.js +12 -20
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/index.d.ts +0 -1
- package/lib/modules/index.js +0 -2
- package/lib/plugins/window.d.ts +0 -1
- package/lib/solution/BookingByStep/utils/resources.js +12 -4
- package/lib/solution/ShopDiscount/index.js +1 -2
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +0 -2
- package/lib/types/index.d.ts +1 -3
- package/package.json +1 -1
- package/dist/modules/Customer/constants.d.ts +0 -7
- package/dist/modules/Customer/constants.js +0 -12
- package/dist/modules/Customer/index.d.ts +0 -122
- package/dist/modules/Customer/index.js +0 -697
- package/dist/modules/Customer/types.d.ts +0 -146
- package/dist/modules/Customer/types.js +0 -41
- package/dist/solution/BookingTicket/index.d.ts +0 -172
- package/dist/solution/BookingTicket/index.js +0 -665
- package/dist/solution/BookingTicket/types.d.ts +0 -68
- package/dist/solution/BookingTicket/types.js +0 -43
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +0 -159
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +0 -174
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/dist/solution/BookingTicket/utils/scan/index.js +0 -285
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +0 -305
- package/dist/utils/task.d.ts +0 -40
- package/dist/utils/task.js +0 -171
- package/dist/utils/watch.d.ts +0 -102
- package/dist/utils/watch.js +0 -294
- package/lib/modules/Customer/constants.d.ts +0 -7
- package/lib/modules/Customer/constants.js +0 -39
- package/lib/modules/Customer/index.d.ts +0 -122
- package/lib/modules/Customer/index.js +0 -440
- package/lib/modules/Customer/types.d.ts +0 -146
- package/lib/modules/Customer/types.js +0 -37
- package/lib/solution/BookingTicket/index.d.ts +0 -172
- package/lib/solution/BookingTicket/index.js +0 -399
- package/lib/solution/BookingTicket/types.d.ts +0 -68
- package/lib/solution/BookingTicket/types.js +0 -72
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +0 -22
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +0 -117
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +0 -16
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +0 -125
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -81
- package/lib/solution/BookingTicket/utils/scan/index.js +0 -210
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +0 -78
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +0 -231
- package/lib/utils/task.d.ts +0 -40
- package/lib/utils/task.js +0 -109
- package/lib/utils/watch.d.ts +0 -102
- package/lib/utils/watch.js +0 -217
package/lib/core/index.js
CHANGED
|
@@ -61,7 +61,7 @@ var PisellOSCore = class {
|
|
|
61
61
|
console.log(`${prefix} ${message}`);
|
|
62
62
|
break;
|
|
63
63
|
case "warn":
|
|
64
|
-
console.
|
|
64
|
+
console.warn(`${prefix} ${message}`);
|
|
65
65
|
break;
|
|
66
66
|
case "error":
|
|
67
67
|
console.error(`${prefix} ${message}`);
|
package/lib/effects/index.d.ts
CHANGED
|
@@ -2,17 +2,16 @@ type EffectCallback = (payload: any) => void | Promise<void | {
|
|
|
2
2
|
status: boolean;
|
|
3
3
|
message?: string;
|
|
4
4
|
}>;
|
|
5
|
-
type UnsubscribeFunction = () => void;
|
|
6
5
|
declare class EffectsManager {
|
|
7
6
|
private listeners;
|
|
8
|
-
on(event: string, callback: EffectCallback):
|
|
7
|
+
on(event: string, callback: EffectCallback): void;
|
|
9
8
|
off(event: string, callback: EffectCallback): void;
|
|
10
9
|
offByModuleDestroy(module: string): void;
|
|
11
|
-
once(event: string, callback: EffectCallback):
|
|
10
|
+
once(event: string, callback: EffectCallback): void;
|
|
12
11
|
emit(event: string, payload: any): Promise<{
|
|
13
12
|
status: boolean;
|
|
14
13
|
data: any;
|
|
15
14
|
}>;
|
|
16
15
|
clear(): void;
|
|
17
16
|
}
|
|
18
|
-
export { EffectsManager
|
|
17
|
+
export { EffectsManager };
|
package/lib/effects/index.js
CHANGED
|
@@ -31,9 +31,6 @@ var EffectsManager = class {
|
|
|
31
31
|
if (!this.listeners.has(event))
|
|
32
32
|
this.listeners.set(event, /* @__PURE__ */ new Set());
|
|
33
33
|
(_a = this.listeners.get(event)) == null ? void 0 : _a.add(callback);
|
|
34
|
-
return () => {
|
|
35
|
-
this.off(event, callback);
|
|
36
|
-
};
|
|
37
34
|
}
|
|
38
35
|
off(event, callback) {
|
|
39
36
|
var _a;
|
|
@@ -52,7 +49,7 @@ var EffectsManager = class {
|
|
|
52
49
|
await callback(payload);
|
|
53
50
|
this.off(event, wrapper);
|
|
54
51
|
};
|
|
55
|
-
|
|
52
|
+
this.on(event, wrapper);
|
|
56
53
|
}
|
|
57
54
|
async emit(event, payload) {
|
|
58
55
|
const callbacks = this.listeners.get(event);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { AccountModule, Account } from '../Account';
|
|
3
3
|
import { BaseModule } from '../BaseModule';
|
|
4
|
-
import { IFetchHolderAccountsParams, IHolder
|
|
4
|
+
import { IFetchHolderAccountsParams, IHolder } from './types';
|
|
5
5
|
export declare class AccountListModule extends BaseModule implements Module {
|
|
6
6
|
protected defaultName: string;
|
|
7
7
|
protected defaultVersion: string;
|
|
@@ -37,12 +37,6 @@ export declare class AccountListModule extends BaseModule implements Module {
|
|
|
37
37
|
customerId: number;
|
|
38
38
|
type?: 'unshift' | 'push';
|
|
39
39
|
}): Promise<AccountModule[]>;
|
|
40
|
-
/**
|
|
41
|
-
* 获取客户列表
|
|
42
|
-
* @param params 查询参数
|
|
43
|
-
* @returns 客户列表
|
|
44
|
-
*/
|
|
45
|
-
getCustomerList(params?: IGetCustomerListParams): Promise<any>;
|
|
46
40
|
/**
|
|
47
41
|
* 获取holder类型账户列表
|
|
48
42
|
* @param params
|
|
@@ -288,33 +288,6 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
|
|
|
288
288
|
);
|
|
289
289
|
return accountModules;
|
|
290
290
|
}
|
|
291
|
-
/**
|
|
292
|
-
* 获取客户列表
|
|
293
|
-
* @param params 查询参数
|
|
294
|
-
* @returns 客户列表
|
|
295
|
-
*/
|
|
296
|
-
async getCustomerList(params = {}) {
|
|
297
|
-
const url = "/customer/es/data";
|
|
298
|
-
const { page = 1, pageSize = 20, keyword, ...otherParams } = params;
|
|
299
|
-
try {
|
|
300
|
-
this.store.isLoading = true;
|
|
301
|
-
this.store.error = null;
|
|
302
|
-
const queryParams = {
|
|
303
|
-
page,
|
|
304
|
-
pageSize,
|
|
305
|
-
...keyword && { keyword },
|
|
306
|
-
...otherParams
|
|
307
|
-
};
|
|
308
|
-
const res = await this.request.get(url, queryParams);
|
|
309
|
-
return (res == null ? void 0 : res.data) || [];
|
|
310
|
-
} catch (error) {
|
|
311
|
-
console.error("Failed to fetch customer list:", error);
|
|
312
|
-
this.store.error = error instanceof Error ? error.message : "Failed to fetch customer list";
|
|
313
|
-
throw error;
|
|
314
|
-
} finally {
|
|
315
|
-
this.store.isLoading = false;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
291
|
/**
|
|
319
292
|
* 获取holder类型账户列表
|
|
320
293
|
* @param params
|
|
@@ -67,31 +67,3 @@ export interface IHolder {
|
|
|
67
67
|
main_field: string;
|
|
68
68
|
customer_cover?: string;
|
|
69
69
|
}
|
|
70
|
-
/**
|
|
71
|
-
* 获取客户列表参数
|
|
72
|
-
*/
|
|
73
|
-
export interface IGetCustomerListParams {
|
|
74
|
-
/** 页码 */
|
|
75
|
-
page?: number;
|
|
76
|
-
/** 每页数量 */
|
|
77
|
-
pageSize?: number;
|
|
78
|
-
/** 搜索关键词 */
|
|
79
|
-
keyword?: string;
|
|
80
|
-
/** 其他筛选参数 */
|
|
81
|
-
[key: string]: any;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 客户数据
|
|
85
|
-
*/
|
|
86
|
-
export interface ICustomer {
|
|
87
|
-
/** 客户ID */
|
|
88
|
-
id: string | number;
|
|
89
|
-
/** 客户姓名 */
|
|
90
|
-
name: string;
|
|
91
|
-
/** 客户电话 */
|
|
92
|
-
phone?: string;
|
|
93
|
-
/** 客户邮箱 */
|
|
94
|
-
email?: string;
|
|
95
|
-
/** 其他客户信息 */
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
}
|
|
@@ -8,20 +8,16 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
8
8
|
protected defaultVersion: string;
|
|
9
9
|
private store;
|
|
10
10
|
private request;
|
|
11
|
+
private otherParams;
|
|
11
12
|
constructor(name?: string, version?: string);
|
|
12
13
|
initialize(core: PisellCore, options: any): Promise<void>;
|
|
13
14
|
storeChange(path?: string, value?: any): Promise<void>;
|
|
14
|
-
loadProducts({ category_ids, product_ids, collection,
|
|
15
|
+
loadProducts({ category_ids, product_ids, collection, schedule_date, cacheId }: {
|
|
15
16
|
category_ids?: number[];
|
|
16
17
|
product_ids?: number[];
|
|
17
18
|
collection?: number | string[];
|
|
18
19
|
schedule_date?: string;
|
|
19
20
|
cacheId?: string;
|
|
20
|
-
customer_id?: number;
|
|
21
|
-
menu_list_ids?: number[];
|
|
22
|
-
schedule_datetime?: string;
|
|
23
|
-
with_count?: string[];
|
|
24
|
-
with_schedule?: number;
|
|
25
21
|
}): Promise<any>;
|
|
26
22
|
loadProductsPrice({ ids, customer_id, schedule_date, channel, }: {
|
|
27
23
|
ids?: number[];
|
|
@@ -33,10 +29,4 @@ export declare class ProductList extends BaseModule implements Module {
|
|
|
33
29
|
getProduct(id: number): Promise<Product | undefined>;
|
|
34
30
|
addProduct(products: ProductData[]): Promise<void>;
|
|
35
31
|
selectProducts(products: ProductData[]): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* 根据商品编码或条码搜索商品
|
|
38
|
-
* @param code 商品编码或条码
|
|
39
|
-
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
40
|
-
*/
|
|
41
|
-
findProductsByCodeOrBarcode(code: string): ProductData[];
|
|
42
32
|
}
|
|
@@ -33,11 +33,13 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
33
33
|
super(name, version);
|
|
34
34
|
this.defaultName = "productList";
|
|
35
35
|
this.defaultVersion = "1.0.0";
|
|
36
|
+
this.otherParams = {};
|
|
36
37
|
}
|
|
37
38
|
async initialize(core, options) {
|
|
38
39
|
var _a;
|
|
39
40
|
this.core = core;
|
|
40
41
|
this.store = options.store;
|
|
42
|
+
this.otherParams = options.otherParams || {};
|
|
41
43
|
if (Array.isArray((_a = options.initialState) == null ? void 0 : _a.list)) {
|
|
42
44
|
this.store.list = options.initialState.list;
|
|
43
45
|
this.core.effects.emit(`${this.name}:changed`, this.store.list);
|
|
@@ -68,19 +70,14 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
68
70
|
category_ids = [],
|
|
69
71
|
product_ids = [],
|
|
70
72
|
collection = [],
|
|
71
|
-
menu_list_ids = [],
|
|
72
|
-
customer_id: paramsCustomerId,
|
|
73
|
-
with_count = [],
|
|
74
|
-
schedule_datetime,
|
|
75
73
|
schedule_date,
|
|
76
|
-
cacheId
|
|
77
|
-
with_schedule
|
|
74
|
+
cacheId
|
|
78
75
|
}) {
|
|
79
|
-
var _a;
|
|
76
|
+
var _a, _b;
|
|
80
77
|
let userPlugin = this.core.getPlugin("user");
|
|
81
78
|
let customer_id = void 0;
|
|
82
79
|
try {
|
|
83
|
-
customer_id =
|
|
80
|
+
customer_id = (_a = userPlugin == null ? void 0 : userPlugin.get()) == null ? void 0 : _a.id;
|
|
84
81
|
} catch (error) {
|
|
85
82
|
console.error(error);
|
|
86
83
|
}
|
|
@@ -106,12 +103,9 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
106
103
|
ids: product_ids,
|
|
107
104
|
collection,
|
|
108
105
|
front_end_cache_id: cacheId,
|
|
109
|
-
menu_list_ids,
|
|
110
|
-
with_count,
|
|
111
106
|
// client_schedule_ids: schedule_ids,
|
|
112
107
|
schedule_date,
|
|
113
|
-
|
|
114
|
-
schedule_datetime
|
|
108
|
+
application_code: (_b = this.otherParams) == null ? void 0 : _b.channel
|
|
115
109
|
},
|
|
116
110
|
{ useCache: true }
|
|
117
111
|
);
|
|
@@ -170,24 +164,6 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
170
164
|
async selectProducts(products) {
|
|
171
165
|
this.store.selectProducts = products;
|
|
172
166
|
}
|
|
173
|
-
/**
|
|
174
|
-
* 根据商品编码或条码搜索商品
|
|
175
|
-
* @param code 商品编码或条码
|
|
176
|
-
* @returns 匹配的商品列表,如果没有匹配则返回空数组
|
|
177
|
-
*/
|
|
178
|
-
findProductsByCodeOrBarcode(code) {
|
|
179
|
-
if (!code || typeof code !== "string") {
|
|
180
|
-
return [];
|
|
181
|
-
}
|
|
182
|
-
const trimmedCode = code.trim();
|
|
183
|
-
if (!trimmedCode) {
|
|
184
|
-
return [];
|
|
185
|
-
}
|
|
186
|
-
const matchingProducts = this.store.list.filter((product) => {
|
|
187
|
-
return product.code && product.code.trim() === trimmedCode || product.barcode && product.barcode.trim() === trimmedCode;
|
|
188
|
-
});
|
|
189
|
-
return (0, import_lodash_es.cloneDeep)(matchingProducts);
|
|
190
|
-
}
|
|
191
167
|
};
|
|
192
168
|
// Annotate the CommonJS export names for ESM import in node:
|
|
193
169
|
0 && (module.exports = {
|
|
@@ -37,7 +37,6 @@ var import_types = require("./types");
|
|
|
37
37
|
var import_utils = require("../../solution/ShopDiscount/utils");
|
|
38
38
|
var import_utils2 = require("../Cart/utils");
|
|
39
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
40
|
-
var import_lodash_es = require("lodash-es");
|
|
41
40
|
var RulesModule = class extends import_BaseModule.BaseModule {
|
|
42
41
|
constructor(name, version) {
|
|
43
42
|
super(name, version);
|
|
@@ -189,23 +188,19 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
189
188
|
if (isAvailableProduct && isLimitedProduct) {
|
|
190
189
|
(_c = discountApplicability.get(discount.id)) == null ? void 0 : _c.push(product.id);
|
|
191
190
|
const applicableProducts = discountApplicableProducts.get(discount.id) || [];
|
|
192
|
-
|
|
193
|
-
const productData = {
|
|
191
|
+
applicableProducts.push({
|
|
194
192
|
amount: product.price,
|
|
195
|
-
type:
|
|
196
|
-
tag:
|
|
193
|
+
type: discount.tag || discount.type,
|
|
194
|
+
tag: discount.tag || discount.type,
|
|
197
195
|
discount: {
|
|
198
196
|
resource_id: discount.id,
|
|
199
197
|
title: discount.format_title,
|
|
200
198
|
original_amount: product.origin_total,
|
|
201
199
|
pre_value: discount.par_value,
|
|
202
200
|
product_id: originProduct.id
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
productData.num = product.num || 1;
|
|
207
|
-
}
|
|
208
|
-
applicableProducts.push(productData);
|
|
201
|
+
},
|
|
202
|
+
num: product.num || 1
|
|
203
|
+
});
|
|
209
204
|
discountApplicableProducts.set(discount.id, applicableProducts);
|
|
210
205
|
}
|
|
211
206
|
});
|
|
@@ -220,9 +215,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
220
215
|
}
|
|
221
216
|
const applicableDiscounts = sortedDiscountList.filter((discount) => {
|
|
222
217
|
var _a2;
|
|
223
|
-
if ((Number(product.price)
|
|
218
|
+
if ((Number(product.price) === 0 || !product.price) && (discount.tag || discount.type) === "good_pass")
|
|
224
219
|
return false;
|
|
225
|
-
if ((Number(product.total)
|
|
220
|
+
if ((Number(product.total) === 0 || !product.total) && !((_a2 = product.discount_list) == null ? void 0 : _a2.find((n) => {
|
|
226
221
|
var _a3;
|
|
227
222
|
return ((_a3 = n.discount) == null ? void 0 : _a3.resource_id) === discount.id;
|
|
228
223
|
})) && (discount.tag || discount.type) !== "good_pass")
|
|
@@ -247,7 +242,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
247
242
|
}))) {
|
|
248
243
|
isManualDiscount = false;
|
|
249
244
|
}
|
|
250
|
-
if (applicableDiscounts.length === 0 || isManualDiscount
|
|
245
|
+
if (applicableDiscounts.length === 0 || isManualDiscount) {
|
|
251
246
|
if (product.isClient) {
|
|
252
247
|
processedProductsMap.set(
|
|
253
248
|
product._id,
|
|
@@ -314,21 +309,18 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
314
309
|
productOriginTotal = product.total;
|
|
315
310
|
}
|
|
316
311
|
const targetProductTotal = selectedDiscount2.tag === "good_pass" ? new import_decimal.default(productOriginTotal).minus(new import_decimal.default(product.price || 0)).toNumber() : new import_decimal.default(100).minus(selectedDiscount2.par_value || 0).div(100).mul(new import_decimal.default(productOriginTotal)).toNumber();
|
|
317
|
-
const discountType = selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag;
|
|
318
312
|
const discountDetail = {
|
|
319
313
|
amount: new import_decimal.default(productOriginTotal).minus(new import_decimal.default(targetProductTotal)).toNumber(),
|
|
320
|
-
type:
|
|
314
|
+
type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
|
|
321
315
|
discount: {
|
|
322
316
|
resource_id: selectedDiscount2.id,
|
|
323
317
|
title: selectedDiscount2.format_title,
|
|
324
318
|
original_amount: productOriginTotal,
|
|
325
319
|
product_id: originProduct.id,
|
|
326
320
|
percent: selectedDiscount2.par_value
|
|
327
|
-
}
|
|
321
|
+
},
|
|
322
|
+
num: product.num || 1
|
|
328
323
|
};
|
|
329
|
-
if ((selectedDiscount2.tag || selectedDiscount2.type) !== "good_pass") {
|
|
330
|
-
discountDetail.num = product.num || 1;
|
|
331
|
-
}
|
|
332
324
|
appliedProducts.push(discountDetail);
|
|
333
325
|
appliedDiscountProducts.set(selectedDiscount2.id, appliedProducts);
|
|
334
326
|
if (product.isClient) {
|
package/lib/modules/index.d.ts
CHANGED
package/lib/modules/index.js
CHANGED
|
@@ -21,7 +21,6 @@ __reExport(modules_exports, require("./ProductList"), module.exports);
|
|
|
21
21
|
__reExport(modules_exports, require("./Cart"), module.exports);
|
|
22
22
|
__reExport(modules_exports, require("./Account"), module.exports);
|
|
23
23
|
__reExport(modules_exports, require("./AccountList"), module.exports);
|
|
24
|
-
__reExport(modules_exports, require("./Customer"), module.exports);
|
|
25
24
|
__reExport(modules_exports, require("./Date"), module.exports);
|
|
26
25
|
__reExport(modules_exports, require("./Guests"), module.exports);
|
|
27
26
|
__reExport(modules_exports, require("./Order"), module.exports);
|
|
@@ -37,7 +36,6 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
|
|
|
37
36
|
...require("./Cart"),
|
|
38
37
|
...require("./Account"),
|
|
39
38
|
...require("./AccountList"),
|
|
40
|
-
...require("./Customer"),
|
|
41
39
|
...require("./Date"),
|
|
42
40
|
...require("./Guests"),
|
|
43
41
|
...require("./Order"),
|
package/lib/plugins/window.d.ts
CHANGED
|
@@ -215,7 +215,9 @@ var getResourcesByProduct = (resourcesMap, resources, selectedResources, capacit
|
|
|
215
215
|
// 是否是只用来计算用,组合资源里,假设商品只关联了组合资源没关联子资源,需要通过这个计算来在后面从 renderList 里删除这个资源
|
|
216
216
|
metadata: {
|
|
217
217
|
...resourcesMap[id].metadata,
|
|
218
|
-
combined_resource: resourcesMap[id].combined_resource
|
|
218
|
+
combined_resource: resourcesMap[id].combined_resource,
|
|
219
|
+
form_name: item.title,
|
|
220
|
+
resource_name: resourcesMap[id].main_field
|
|
219
221
|
}
|
|
220
222
|
})
|
|
221
223
|
);
|
|
@@ -230,7 +232,9 @@ var getResourcesByProduct = (resourcesMap, resources, selectedResources, capacit
|
|
|
230
232
|
children: combiningResources,
|
|
231
233
|
metadata: {
|
|
232
234
|
...resourcesMap[d].metadata,
|
|
233
|
-
combined_resource: resourcesMap[d].combined_resource
|
|
235
|
+
combined_resource: resourcesMap[d].combined_resource,
|
|
236
|
+
form_name: item.title,
|
|
237
|
+
resource_name: resourcesMap[d].main_field
|
|
234
238
|
}
|
|
235
239
|
})
|
|
236
240
|
);
|
|
@@ -259,7 +263,9 @@ var getResourcesByProduct = (resourcesMap, resources, selectedResources, capacit
|
|
|
259
263
|
// 是否是只用来计算用,组合资源里,假设商品只关联了组合资源没关联子资源,需要通过这个计算来在后面从 renderList 里删除这个资源
|
|
260
264
|
metadata: {
|
|
261
265
|
...resourcesMap[id].metadata,
|
|
262
|
-
combined_resource: resourcesMap[id].combined_resource
|
|
266
|
+
combined_resource: resourcesMap[id].combined_resource,
|
|
267
|
+
form_name: item.title,
|
|
268
|
+
resource_name: resourcesMap[id].main_field
|
|
263
269
|
}
|
|
264
270
|
})
|
|
265
271
|
);
|
|
@@ -275,7 +281,9 @@ var getResourcesByProduct = (resourcesMap, resources, selectedResources, capacit
|
|
|
275
281
|
children: combiningResources,
|
|
276
282
|
metadata: {
|
|
277
283
|
...resourcesMap[d].metadata,
|
|
278
|
-
combined_resource: resourcesMap[d].combined_resource
|
|
284
|
+
combined_resource: resourcesMap[d].combined_resource,
|
|
285
|
+
form_name: item.title,
|
|
286
|
+
resource_name: resourcesMap[d].main_field
|
|
279
287
|
}
|
|
280
288
|
})
|
|
281
289
|
);
|
|
@@ -38,7 +38,6 @@ var import_types = require("./types");
|
|
|
38
38
|
var import_Discount = require("../../modules/Discount");
|
|
39
39
|
var import_Rules = require("../../modules/Rules");
|
|
40
40
|
var import_decimal = __toESM(require("decimal.js"));
|
|
41
|
-
var import_lodash_es = require("lodash-es");
|
|
42
41
|
var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
43
42
|
constructor(name, version) {
|
|
44
43
|
super(name, version);
|
|
@@ -338,7 +337,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
338
337
|
var _a2;
|
|
339
338
|
const targetProduct = productList.find((n) => n.id === id);
|
|
340
339
|
const product = (_a2 = this.hooks) == null ? void 0 : _a2.getProduct(targetProduct);
|
|
341
|
-
return Number(product == null ? void 0 : product.total)
|
|
340
|
+
return Number(product == null ? void 0 : product.total) === 0 && (Number(product == null ? void 0 : product.origin_total) === 0 || !(product == null ? void 0 : product.origin_total));
|
|
342
341
|
};
|
|
343
342
|
const allUsedProductIds = newDiscountList.map((n) => {
|
|
344
343
|
var _a2;
|
package/lib/solution/index.d.ts
CHANGED
package/lib/solution/index.js
CHANGED
|
@@ -18,12 +18,10 @@ var solution_exports = {};
|
|
|
18
18
|
module.exports = __toCommonJS(solution_exports);
|
|
19
19
|
__reExport(solution_exports, require("./BuyTickets"), module.exports);
|
|
20
20
|
__reExport(solution_exports, require("./BookingByStep"), module.exports);
|
|
21
|
-
__reExport(solution_exports, require("./BookingTicket"), module.exports);
|
|
22
21
|
__reExport(solution_exports, require("./ShopDiscount"), module.exports);
|
|
23
22
|
// Annotate the CommonJS export names for ESM import in node:
|
|
24
23
|
0 && (module.exports = {
|
|
25
24
|
...require("./BuyTickets"),
|
|
26
25
|
...require("./BookingByStep"),
|
|
27
|
-
...require("./BookingTicket"),
|
|
28
26
|
...require("./ShopDiscount")
|
|
29
27
|
});
|
package/lib/types/index.d.ts
CHANGED
|
@@ -38,9 +38,7 @@ export interface PisellCore {
|
|
|
38
38
|
getModuleExports: <T = any>(name: string) => T | null;
|
|
39
39
|
hasModule: (name: string) => boolean;
|
|
40
40
|
effects: {
|
|
41
|
-
on: (event: string, callback: (payload: any) => void) =>
|
|
42
|
-
once: (event: string, callback: (payload: any) => void) => () => void;
|
|
43
|
-
off: (event: string, callback: (payload: any) => void) => void;
|
|
41
|
+
on: (event: string, callback: (payload: any) => void) => void;
|
|
44
42
|
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
45
43
|
status: boolean;
|
|
46
44
|
data: any;
|
package/package.json
CHANGED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
|
-
import { BaseModule } from '../BaseModule';
|
|
3
|
-
import { CustomerState, ShopCustomer, ShopGetCustomerListParams, CustomerModuleAPI, IPaginationInfo, ICustomerListResponse } from './types';
|
|
4
|
-
export declare class CustomerModule extends BaseModule implements Module, CustomerModuleAPI {
|
|
5
|
-
protected defaultName: string;
|
|
6
|
-
protected defaultVersion: string;
|
|
7
|
-
private store;
|
|
8
|
-
private request;
|
|
9
|
-
private cacheId;
|
|
10
|
-
private openCache;
|
|
11
|
-
private fatherModule;
|
|
12
|
-
constructor(name?: string, version?: string);
|
|
13
|
-
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* 获取客户列表数据(内部方法)
|
|
16
|
-
* @param params 查询参数
|
|
17
|
-
* @returns API响应数据
|
|
18
|
-
*/
|
|
19
|
-
private fetchCustomerListData;
|
|
20
|
-
/**
|
|
21
|
-
* 处理客户列表操作的错误(内部方法)
|
|
22
|
-
* @param error 错误对象
|
|
23
|
-
* @param operation 操作名称
|
|
24
|
-
*/
|
|
25
|
-
private handleCustomerListError;
|
|
26
|
-
/**
|
|
27
|
-
* 获取客户列表
|
|
28
|
-
* @param params 查询参数
|
|
29
|
-
* @returns 客户列表响应
|
|
30
|
-
*/
|
|
31
|
-
getCustomerList(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
32
|
-
/**
|
|
33
|
-
* 设置客户列表
|
|
34
|
-
* @param customers 客户列表
|
|
35
|
-
* @param total 总数
|
|
36
|
-
*/
|
|
37
|
-
setCustomerList(customers: ShopCustomer[], total?: number): void;
|
|
38
|
-
/**
|
|
39
|
-
* 设置当前选择的客户
|
|
40
|
-
* @param customer 选择的客户
|
|
41
|
-
*/
|
|
42
|
-
setSelectedCustomer(customer: ShopCustomer | null): void;
|
|
43
|
-
/**
|
|
44
|
-
* 获取当前选择的客户
|
|
45
|
-
* @returns 当前选择的客户
|
|
46
|
-
*/
|
|
47
|
-
getSelectedCustomer(): ShopCustomer | null;
|
|
48
|
-
/**
|
|
49
|
-
* 获取客户列表
|
|
50
|
-
* @returns 客户列表
|
|
51
|
-
*/
|
|
52
|
-
getCustomers(): ShopCustomer[];
|
|
53
|
-
/**
|
|
54
|
-
* 根据ID查找客户
|
|
55
|
-
* @param id 客户ID
|
|
56
|
-
* @returns 客户信息
|
|
57
|
-
*/
|
|
58
|
-
getCustomerById(id: string | number): ShopCustomer | null;
|
|
59
|
-
/**
|
|
60
|
-
* 清空客户列表
|
|
61
|
-
*/
|
|
62
|
-
clearCustomers(): void;
|
|
63
|
-
/**
|
|
64
|
-
* 添加客户到列表第一位
|
|
65
|
-
* @param customer 要添加的客户信息
|
|
66
|
-
*/
|
|
67
|
-
addCustomerToFirst(customer: ShopCustomer): void;
|
|
68
|
-
/**
|
|
69
|
-
* 获取当前状态
|
|
70
|
-
* @returns 当前状态
|
|
71
|
-
*/
|
|
72
|
-
getState(): CustomerState;
|
|
73
|
-
/**
|
|
74
|
-
* 获取分页信息
|
|
75
|
-
* @returns 分页信息
|
|
76
|
-
*/
|
|
77
|
-
getPaginationInfo(): IPaginationInfo;
|
|
78
|
-
/**
|
|
79
|
-
* 触发分页变化事件
|
|
80
|
-
* @param pagination 分页信息
|
|
81
|
-
*/
|
|
82
|
-
triggerPaginationChange(pagination: IPaginationInfo): void;
|
|
83
|
-
/**
|
|
84
|
-
* 设置分页信息
|
|
85
|
-
* @param page 页码
|
|
86
|
-
* @param pageSize 每页数量
|
|
87
|
-
*/
|
|
88
|
-
setPaginationInfo(page: number, pageSize: number): void;
|
|
89
|
-
/**
|
|
90
|
-
* 便捷方法:切换分页并自动获取数据
|
|
91
|
-
* @param page 页码
|
|
92
|
-
* @param pageSize 每页数量(可选,不传则使用当前pageSize)
|
|
93
|
-
* @returns 客户列表响应
|
|
94
|
-
*/
|
|
95
|
-
changeCustomerPage(page: number, pageSize?: number): Promise<ICustomerListResponse>;
|
|
96
|
-
/**
|
|
97
|
-
* 滚动加载更多客户数据 - 数据会追加到现有列表中
|
|
98
|
-
* @returns 客户列表响应
|
|
99
|
-
*/
|
|
100
|
-
loadMoreCustomers(): Promise<ICustomerListResponse>;
|
|
101
|
-
/**
|
|
102
|
-
* 重置并重新开始滚动加载
|
|
103
|
-
* @param params 查询参数
|
|
104
|
-
* @returns 客户列表响应
|
|
105
|
-
*/
|
|
106
|
-
resetAndLoadCustomers(params?: ShopGetCustomerListParams): Promise<ICustomerListResponse>;
|
|
107
|
-
/**
|
|
108
|
-
* 检查是否还有更多数据可以加载
|
|
109
|
-
* @returns 是否还有更多数据
|
|
110
|
-
*/
|
|
111
|
-
hasMoreCustomers(): boolean;
|
|
112
|
-
/**
|
|
113
|
-
* 获取当前的搜索条件
|
|
114
|
-
* @returns 当前搜索条件
|
|
115
|
-
*/
|
|
116
|
-
getCurrentSearchParams(): Omit<ShopGetCustomerListParams, 'skip' | 'num'>;
|
|
117
|
-
/**
|
|
118
|
-
* 缓存状态变化
|
|
119
|
-
*/
|
|
120
|
-
private storeChange;
|
|
121
|
-
}
|
|
122
|
-
export * from './types';
|