@pisell/pisellos 0.0.324 → 0.0.326
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/effects/index.d.ts +2 -2
- package/dist/modules/Account/index.js +2 -3
- package/dist/modules/BaseModule.d.ts +3 -0
- package/dist/modules/BaseModule.js +15 -0
- package/dist/modules/Customer/index.js +9 -10
- package/dist/modules/Customer/types.d.ts +1 -1
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Payment/index.js +18 -18
- package/dist/modules/Payment/types.d.ts +7 -7
- package/dist/modules/Payment/walletpass.js +4 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -3
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/modules/Rules/types.d.ts +1 -1
- package/dist/modules/Schedule/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +9 -9
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +2 -2
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +7 -7
- package/dist/solution/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/index.js +29 -29
- package/dist/solution/ShopDiscount/index.js +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/task.d.ts +2 -2
- package/dist/utils/watch.d.ts +2 -2
- package/lib/core/index.js +28 -27
- package/lib/effects/index.d.ts +2 -2
- package/lib/effects/index.js +7 -3
- package/lib/modules/Account/index.js +12 -12
- package/lib/modules/AccountList/index.js +11 -14
- package/lib/modules/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +12 -6
- package/lib/modules/Cart/index.js +9 -14
- package/lib/modules/Cart/utils/cartProduct.js +6 -3
- package/lib/modules/Customer/constants.js +1 -1
- package/lib/modules/Customer/index.js +24 -28
- package/lib/modules/Customer/types.d.ts +1 -1
- package/lib/modules/Date/index.js +6 -10
- package/lib/modules/Date/types.js +0 -1
- package/lib/modules/Discount/index.js +7 -12
- package/lib/modules/Guests/index.js +24 -19
- package/lib/modules/Order/index.js +9 -11
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +86 -97
- package/lib/modules/Payment/types.d.ts +7 -7
- package/lib/modules/Payment/utils.js +6 -3
- package/lib/modules/Payment/walletpass.js +34 -32
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/index.js +5 -6
- package/lib/modules/ProductList/index.js +5 -8
- package/lib/modules/Resource/index.js +13 -9
- package/lib/modules/Rules/index.js +19 -15
- package/lib/modules/Rules/types.d.ts +1 -1
- package/lib/modules/Schedule/index.js +5 -8
- package/lib/modules/Schedule/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +9 -9
- package/lib/modules/Schedule/utils.js +4 -2
- package/lib/modules/Step/index.js +4 -7
- package/lib/modules/Summary/index.js +4 -9
- package/lib/plugins/request.js +33 -34
- package/lib/plugins/window.js +113 -101
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +105 -71
- package/lib/solution/BookingByStep/utils/capacity.js +15 -10
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +8 -4
- package/lib/solution/BookingByStep/utils/stock.js +6 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +27 -24
- package/lib/solution/BookingTicket/index.js +20 -25
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +3 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +6 -6
- package/lib/solution/BookingTicket/utils/scan/index.js +1 -3
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +9 -10
- package/lib/solution/BuyTickets/index.js +22 -23
- package/lib/solution/Checkout/index.js +227 -234
- package/lib/solution/Checkout/utils/index.js +22 -18
- package/lib/solution/ShopDiscount/index.js +12 -16
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/utils/task.d.ts +2 -2
- package/lib/utils/task.js +3 -3
- package/lib/utils/watch.d.ts +2 -2
- package/lib/utils/watch.js +7 -5
- package/package.json +1 -1
package/lib/effects/index.js
CHANGED
|
@@ -23,10 +23,13 @@ __export(effects_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(effects_exports);
|
|
25
25
|
var EffectsManager = class {
|
|
26
|
-
|
|
26
|
+
constructor() {
|
|
27
|
+
this.listeners = /* @__PURE__ */ new Map();
|
|
28
|
+
}
|
|
27
29
|
on(event, callback) {
|
|
28
30
|
var _a;
|
|
29
|
-
if (!this.listeners.has(event))
|
|
31
|
+
if (!this.listeners.has(event))
|
|
32
|
+
this.listeners.set(event, /* @__PURE__ */ new Set());
|
|
30
33
|
(_a = this.listeners.get(event)) == null ? void 0 : _a.add(callback);
|
|
31
34
|
return () => {
|
|
32
35
|
this.off(event, callback);
|
|
@@ -53,7 +56,8 @@ var EffectsManager = class {
|
|
|
53
56
|
}
|
|
54
57
|
async emit(event, payload) {
|
|
55
58
|
const callbacks = this.listeners.get(event);
|
|
56
|
-
if (!callbacks)
|
|
59
|
+
if (!callbacks)
|
|
60
|
+
return { status: true, data: [] };
|
|
57
61
|
return new Promise(async (resolve) => {
|
|
58
62
|
const res = [];
|
|
59
63
|
for (const cb of callbacks) {
|
|
@@ -24,19 +24,18 @@ __export(Account_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(Account_exports);
|
|
26
26
|
var import_BaseModule = require("../BaseModule");
|
|
27
|
-
var import_types = require("./types");
|
|
28
27
|
__reExport(Account_exports, require("./types"), module.exports);
|
|
29
28
|
var AccountModule = class extends import_BaseModule.BaseModule {
|
|
30
|
-
defaultName = "account";
|
|
31
|
-
defaultVersion = "1.0.0";
|
|
32
|
-
isGuest = false;
|
|
33
|
-
store = {
|
|
34
|
-
accountInfo: null,
|
|
35
|
-
isLoggedIn: false,
|
|
36
|
-
active: false
|
|
37
|
-
};
|
|
38
29
|
constructor(name, version) {
|
|
39
30
|
super(name, version);
|
|
31
|
+
this.defaultName = "account";
|
|
32
|
+
this.defaultVersion = "1.0.0";
|
|
33
|
+
this.isGuest = false;
|
|
34
|
+
this.store = {
|
|
35
|
+
accountInfo: null,
|
|
36
|
+
isLoggedIn: false,
|
|
37
|
+
active: false
|
|
38
|
+
};
|
|
40
39
|
}
|
|
41
40
|
async initialize(core, options) {
|
|
42
41
|
this.core = core;
|
|
@@ -59,19 +58,20 @@ var AccountModule = class extends import_BaseModule.BaseModule {
|
|
|
59
58
|
};
|
|
60
59
|
this.store.accountInfo = account;
|
|
61
60
|
this.store.isLoggedIn = true;
|
|
62
|
-
await this.core.effects.emit(
|
|
61
|
+
await this.core.effects.emit(`${this.name}:onLogin`, account);
|
|
63
62
|
}
|
|
64
63
|
getCurrentAccount() {
|
|
65
64
|
return this.store.accountInfo;
|
|
66
65
|
}
|
|
67
66
|
async updateProfile(updates) {
|
|
68
|
-
if (!this.store.accountInfo)
|
|
67
|
+
if (!this.store.accountInfo)
|
|
68
|
+
return;
|
|
69
69
|
this.store.accountInfo = {
|
|
70
70
|
...this.store.accountInfo,
|
|
71
71
|
...updates
|
|
72
72
|
};
|
|
73
73
|
await this.core.effects.emit(
|
|
74
|
-
|
|
74
|
+
`${this.name}:onProfileUpdate`,
|
|
75
75
|
this.store.accountInfo
|
|
76
76
|
);
|
|
77
77
|
}
|
|
@@ -28,22 +28,19 @@ var import_BaseModule = require("../BaseModule");
|
|
|
28
28
|
var import_types = require("./types");
|
|
29
29
|
var import_utils = require("./utils");
|
|
30
30
|
var AccountListModule = class extends import_BaseModule.BaseModule {
|
|
31
|
-
defaultName = "accountList";
|
|
32
|
-
defaultVersion = "1.0.0";
|
|
33
|
-
store = {
|
|
34
|
-
accountList: [],
|
|
35
|
-
// 账号的纯数据列表
|
|
36
|
-
accounts: [],
|
|
37
|
-
// 账号的 module 列表
|
|
38
|
-
isLoading: false,
|
|
39
|
-
error: null
|
|
40
|
-
};
|
|
41
|
-
request;
|
|
42
|
-
cacheId;
|
|
43
|
-
openCache = false;
|
|
44
|
-
fatherModule;
|
|
45
31
|
constructor(name, version) {
|
|
46
32
|
super(name, version);
|
|
33
|
+
this.defaultName = "accountList";
|
|
34
|
+
this.defaultVersion = "1.0.0";
|
|
35
|
+
this.store = {
|
|
36
|
+
accountList: [],
|
|
37
|
+
// 账号的纯数据列表
|
|
38
|
+
accounts: [],
|
|
39
|
+
// 账号的 module 列表
|
|
40
|
+
isLoading: false,
|
|
41
|
+
error: null
|
|
42
|
+
};
|
|
43
|
+
this.openCache = false;
|
|
47
44
|
}
|
|
48
45
|
async initialize(core, options) {
|
|
49
46
|
var _a, _b, _c;
|
|
@@ -14,4 +14,7 @@ export declare class BaseModule {
|
|
|
14
14
|
store: any;
|
|
15
15
|
cacheKey: string[];
|
|
16
16
|
}): void;
|
|
17
|
+
effectsOn(eventType: string, callback: (payload: any) => void): () => void;
|
|
18
|
+
effectsOff(eventType: string, callback: (payload: any) => void): void;
|
|
19
|
+
effectsOnce(eventType: string, callback: (payload: any) => void): () => void;
|
|
17
20
|
}
|
|
@@ -23,13 +23,10 @@ __export(BaseModule_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(BaseModule_exports);
|
|
25
25
|
var BaseModule = class {
|
|
26
|
-
defaultName = "baseModule";
|
|
27
|
-
defaultVersion = "1.0.0";
|
|
28
|
-
name;
|
|
29
|
-
version;
|
|
30
|
-
isSolution = false;
|
|
31
|
-
core;
|
|
32
26
|
constructor(name, version) {
|
|
27
|
+
this.defaultName = "baseModule";
|
|
28
|
+
this.defaultVersion = "1.0.0";
|
|
29
|
+
this.isSolution = false;
|
|
33
30
|
this.name = name || this.defaultName;
|
|
34
31
|
this.version = version || this.defaultVersion;
|
|
35
32
|
}
|
|
@@ -87,6 +84,15 @@ var BaseModule = class {
|
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
86
|
}
|
|
87
|
+
effectsOn(eventType, callback) {
|
|
88
|
+
return this.core.effects.on(`${this.name}:${eventType}`, callback);
|
|
89
|
+
}
|
|
90
|
+
effectsOff(eventType, callback) {
|
|
91
|
+
return this.core.effects.off(`${this.name}:${eventType}`, callback);
|
|
92
|
+
}
|
|
93
|
+
effectsOnce(eventType, callback) {
|
|
94
|
+
return this.core.effects.once(`${this.name}:${eventType}`, callback);
|
|
95
|
+
}
|
|
90
96
|
};
|
|
91
97
|
// Annotate the CommonJS export names for ESM import in node:
|
|
92
98
|
0 && (module.exports = {
|
|
@@ -32,17 +32,12 @@ var import_utils2 = require("../Product/utils");
|
|
|
32
32
|
__reExport(Cart_exports, require("./types"), module.exports);
|
|
33
33
|
var import_utils3 = require("./utils");
|
|
34
34
|
var CartModule = class extends import_BaseModule.BaseModule {
|
|
35
|
-
// 提供给 baseModule 用的默认名称 和 默认版本
|
|
36
|
-
defaultName = "cart";
|
|
37
|
-
defaultVersion = "1.0.0";
|
|
38
|
-
request;
|
|
39
|
-
window;
|
|
40
|
-
store;
|
|
41
|
-
cacheId;
|
|
42
|
-
openCache = false;
|
|
43
|
-
fatherModule;
|
|
44
35
|
constructor(name, version) {
|
|
45
36
|
super(name || "cart", version || "1.0.0");
|
|
37
|
+
// 提供给 baseModule 用的默认名称 和 默认版本
|
|
38
|
+
this.defaultName = "cart";
|
|
39
|
+
this.defaultVersion = "1.0.0";
|
|
40
|
+
this.openCache = false;
|
|
46
41
|
}
|
|
47
42
|
/**
|
|
48
43
|
* 初始化购物车模块
|
|
@@ -67,12 +62,12 @@ var CartModule = class extends import_BaseModule.BaseModule {
|
|
|
67
62
|
this.request = core.getPlugin("request");
|
|
68
63
|
this.window = core.getPlugin("window");
|
|
69
64
|
if (!this.request) {
|
|
70
|
-
throw new Error("
|
|
65
|
+
throw new Error("购物车模块需要 request 插件支持");
|
|
71
66
|
}
|
|
72
67
|
if (!this.window) {
|
|
73
|
-
throw new Error("
|
|
68
|
+
throw new Error("购物车模块需要 window 插件支持");
|
|
74
69
|
}
|
|
75
|
-
console.log("[CartModule]
|
|
70
|
+
console.log("[CartModule] 初始化完成");
|
|
76
71
|
}
|
|
77
72
|
/**
|
|
78
73
|
* 添加商品到购物车
|
|
@@ -123,7 +118,7 @@ var CartModule = class extends import_BaseModule.BaseModule {
|
|
|
123
118
|
this.store.list = [...items];
|
|
124
119
|
await this.core.effects.emit(`${this.name}:onUpdateItem`, tempCartItem);
|
|
125
120
|
} catch (error) {
|
|
126
|
-
console.error("[CartModule]
|
|
121
|
+
console.error("[CartModule] 更新购物车商品失败", error);
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
124
|
// 更新购物车中商品的初始信息
|
|
@@ -160,7 +155,7 @@ var CartModule = class extends import_BaseModule.BaseModule {
|
|
|
160
155
|
quantity = (tempCartItem == null ? void 0 : tempCartItem.num) || 1;
|
|
161
156
|
}
|
|
162
157
|
if (!tempCartItem) {
|
|
163
|
-
throw new Error("[CartModule]
|
|
158
|
+
throw new Error("[CartModule] 格式化数据到购物车失败,商品不存在");
|
|
164
159
|
}
|
|
165
160
|
if (cartItem) {
|
|
166
161
|
tempCartItem = cartItem;
|
|
@@ -218,7 +218,8 @@ var getProductOriginTotalPrice = (params) => {
|
|
|
218
218
|
return price;
|
|
219
219
|
};
|
|
220
220
|
var formatOptions = (options) => {
|
|
221
|
-
if (!(options == null ? void 0 : options.length))
|
|
221
|
+
if (!(options == null ? void 0 : options.length))
|
|
222
|
+
return [];
|
|
222
223
|
return options.map((item) => {
|
|
223
224
|
return {
|
|
224
225
|
id: item == null ? void 0 : item.id,
|
|
@@ -243,7 +244,8 @@ var formatOptionsToOrigin = (options) => {
|
|
|
243
244
|
});
|
|
244
245
|
};
|
|
245
246
|
var formatBundle = (bundle) => {
|
|
246
|
-
if (!(bundle == null ? void 0 : bundle.length))
|
|
247
|
+
if (!(bundle == null ? void 0 : bundle.length))
|
|
248
|
+
return [];
|
|
247
249
|
return bundle.map((item) => {
|
|
248
250
|
return {
|
|
249
251
|
id: item == null ? void 0 : item.id,
|
|
@@ -259,7 +261,8 @@ var formatBundle = (bundle) => {
|
|
|
259
261
|
});
|
|
260
262
|
};
|
|
261
263
|
var formatBundleToOrigin = (bundle) => {
|
|
262
|
-
if (!(bundle == null ? void 0 : bundle.length))
|
|
264
|
+
if (!(bundle == null ? void 0 : bundle.length))
|
|
265
|
+
return [];
|
|
263
266
|
return bundle.map((d) => {
|
|
264
267
|
return {
|
|
265
268
|
bundle_group_id: d.group_id,
|
|
@@ -29,7 +29,7 @@ var DEFAULT_PAGE_SIZE = 20;
|
|
|
29
29
|
var DEFAULT_CUSTOMER = {
|
|
30
30
|
"id": 1,
|
|
31
31
|
"nickname": "Select a customer",
|
|
32
|
-
"name": "
|
|
32
|
+
"name": "选择一个客户"
|
|
33
33
|
};
|
|
34
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
35
35
|
0 && (module.exports = {
|
|
@@ -25,30 +25,26 @@ __export(Customer_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(Customer_exports);
|
|
26
26
|
var import_lodash_es = require("lodash-es");
|
|
27
27
|
var import_BaseModule = require("../BaseModule");
|
|
28
|
-
var import_types = require("./types");
|
|
29
28
|
var import_constants = require("./constants");
|
|
30
29
|
__reExport(Customer_exports, require("./types"), module.exports);
|
|
31
30
|
var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
32
|
-
defaultName = "customer";
|
|
33
|
-
defaultVersion = "1.0.0";
|
|
34
|
-
store = {
|
|
35
|
-
customerList: [],
|
|
36
|
-
selectedCustomer: null,
|
|
37
|
-
total: 0,
|
|
38
|
-
currentPage: 1,
|
|
39
|
-
pageSize: import_constants.DEFAULT_PAGE_SIZE,
|
|
40
|
-
loading: false,
|
|
41
|
-
error: null,
|
|
42
|
-
hasMore: true,
|
|
43
|
-
loadingMore: false,
|
|
44
|
-
searchParams: {}
|
|
45
|
-
};
|
|
46
|
-
request;
|
|
47
|
-
cacheId;
|
|
48
|
-
openCache = false;
|
|
49
|
-
fatherModule;
|
|
50
31
|
constructor(name, version) {
|
|
51
32
|
super(name, version);
|
|
33
|
+
this.defaultName = "customer";
|
|
34
|
+
this.defaultVersion = "1.0.0";
|
|
35
|
+
this.store = {
|
|
36
|
+
customerList: [],
|
|
37
|
+
selectedCustomer: null,
|
|
38
|
+
total: 0,
|
|
39
|
+
currentPage: 1,
|
|
40
|
+
pageSize: import_constants.DEFAULT_PAGE_SIZE,
|
|
41
|
+
loading: false,
|
|
42
|
+
error: null,
|
|
43
|
+
hasMore: true,
|
|
44
|
+
loadingMore: false,
|
|
45
|
+
searchParams: {}
|
|
46
|
+
};
|
|
47
|
+
this.openCache = false;
|
|
52
48
|
}
|
|
53
49
|
async initialize(core, options) {
|
|
54
50
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
@@ -131,7 +127,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
131
127
|
console.error(`Failed to ${operation}:`, error);
|
|
132
128
|
this.store.error = error instanceof Error ? error.message : `Failed to ${operation}`;
|
|
133
129
|
await this.core.effects.emit(
|
|
134
|
-
|
|
130
|
+
`${this.name}:onCustomerListError`,
|
|
135
131
|
this.store.error
|
|
136
132
|
);
|
|
137
133
|
}
|
|
@@ -153,7 +149,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
153
149
|
this.store.hasMore = page * pageSize < total;
|
|
154
150
|
this.store.customerList = (0, import_lodash_es.cloneDeep)(customerList);
|
|
155
151
|
await this.core.effects.emit(
|
|
156
|
-
|
|
152
|
+
`${this.name}:onCustomerListUpdate`,
|
|
157
153
|
this.store
|
|
158
154
|
);
|
|
159
155
|
this.triggerPaginationChange({
|
|
@@ -196,7 +192,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
196
192
|
setSelectedCustomer(customer) {
|
|
197
193
|
this.store.selectedCustomer = !customer ? import_constants.DEFAULT_CUSTOMER : (0, import_lodash_es.cloneDeep)(customer);
|
|
198
194
|
this.core.effects.emit(
|
|
199
|
-
|
|
195
|
+
`${this.name}:onCustomerSelected`,
|
|
200
196
|
this.store.selectedCustomer
|
|
201
197
|
);
|
|
202
198
|
this.storeChange();
|
|
@@ -236,7 +232,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
236
232
|
this.store.loadingMore = false;
|
|
237
233
|
this.store.searchParams = {};
|
|
238
234
|
this.core.effects.emit(
|
|
239
|
-
|
|
235
|
+
`${this.name}:onCustomerListUpdate`,
|
|
240
236
|
this.store
|
|
241
237
|
);
|
|
242
238
|
this.storeChange();
|
|
@@ -250,7 +246,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
250
246
|
this.store.customerList = [newCustomer, ...this.store.customerList];
|
|
251
247
|
this.store.total += 1;
|
|
252
248
|
this.core.effects.emit(
|
|
253
|
-
|
|
249
|
+
`${this.name}:onCustomerListUpdate`,
|
|
254
250
|
this.store
|
|
255
251
|
);
|
|
256
252
|
this.storeChange();
|
|
@@ -280,7 +276,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
280
276
|
*/
|
|
281
277
|
triggerPaginationChange(pagination) {
|
|
282
278
|
this.core.effects.emit(
|
|
283
|
-
|
|
279
|
+
`${this.name}:onPaginationChange`,
|
|
284
280
|
pagination
|
|
285
281
|
);
|
|
286
282
|
}
|
|
@@ -347,7 +343,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
347
343
|
this.store.total = total;
|
|
348
344
|
this.store.hasMore = page * pageSize < total;
|
|
349
345
|
await this.core.effects.emit(
|
|
350
|
-
|
|
346
|
+
`${this.name}:onScrollLoadMore`,
|
|
351
347
|
{
|
|
352
348
|
newCustomers,
|
|
353
349
|
allCustomers: this.store.customerList,
|
|
@@ -356,7 +352,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
356
352
|
}
|
|
357
353
|
);
|
|
358
354
|
await this.core.effects.emit(
|
|
359
|
-
|
|
355
|
+
`${this.name}:onCustomerListUpdate`,
|
|
360
356
|
this.store
|
|
361
357
|
);
|
|
362
358
|
this.triggerPaginationChange({
|
|
@@ -398,7 +394,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
398
394
|
};
|
|
399
395
|
const response = await this.getCustomerList(resetParams);
|
|
400
396
|
await this.core.effects.emit(
|
|
401
|
-
|
|
397
|
+
`${this.name}:onScrollLoadComplete`,
|
|
402
398
|
{
|
|
403
399
|
customers: this.store.customerList,
|
|
404
400
|
total: this.store.total,
|
|
@@ -33,7 +33,7 @@ export interface ShopCustomer extends ICustomer {
|
|
|
33
33
|
* walletDetails.wallet: 用户所有wallet
|
|
34
34
|
* latestWalletDetail.wallet: 用户最新wallet
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
type CustomerWith = 'formRecord' | 'walletDetails.wallet' | 'latestWalletDetail.wallet';
|
|
37
37
|
/**
|
|
38
38
|
* 获取客户列表参数
|
|
39
39
|
*/
|
|
@@ -37,15 +37,11 @@ var import_BaseModule = require("../BaseModule");
|
|
|
37
37
|
var import_utils = require("./utils");
|
|
38
38
|
var import_cloneDeep = __toESM(require("lodash-es/cloneDeep"));
|
|
39
39
|
var DateModule = class extends import_BaseModule.BaseModule {
|
|
40
|
-
defaultName = "date";
|
|
41
|
-
defaultVersion = "1.0.0";
|
|
42
|
-
store;
|
|
43
|
-
request;
|
|
44
|
-
cacheId;
|
|
45
|
-
openCache = false;
|
|
46
|
-
fatherModule;
|
|
47
40
|
constructor(name, version) {
|
|
48
41
|
super(name, version);
|
|
42
|
+
this.defaultName = "date";
|
|
43
|
+
this.defaultVersion = "1.0.0";
|
|
44
|
+
this.openCache = false;
|
|
49
45
|
}
|
|
50
46
|
async initialize(core, options) {
|
|
51
47
|
var _a, _b;
|
|
@@ -57,7 +53,7 @@ var DateModule = class extends import_BaseModule.BaseModule {
|
|
|
57
53
|
this.store.dateList = options.initialState.dateList;
|
|
58
54
|
}
|
|
59
55
|
if (!this.request) {
|
|
60
|
-
throw new Error("DateModule
|
|
56
|
+
throw new Error("DateModule 需要 request 插件支持");
|
|
61
57
|
}
|
|
62
58
|
if ((_a = options.otherParams) == null ? void 0 : _a.cacheId) {
|
|
63
59
|
this.openCache = options.otherParams.openCache;
|
|
@@ -195,13 +191,13 @@ var DateModule = class extends import_BaseModule.BaseModule {
|
|
|
195
191
|
if (startAt.isBefore(resourceStartTime)) {
|
|
196
192
|
const roundedStartTime = this.roundUpToNext10Minutes(resourceStartTime);
|
|
197
193
|
const roundedStartTimeDayjs = (0, import_dayjs.default)(roundedStartTime);
|
|
198
|
-
console.log(`[DateModule]
|
|
194
|
+
console.log(`[DateModule] 修正时间段开始时间: ${timeSlot.start_at} -> ${roundedStartTime} (资源ID: ${resource.id}, 原始start_time: ${resource.start_time})`);
|
|
199
195
|
const correctedTimeSlot = {
|
|
200
196
|
...timeSlot,
|
|
201
197
|
start_at: roundedStartTime
|
|
202
198
|
};
|
|
203
199
|
if (endAt.isBefore(roundedStartTimeDayjs)) {
|
|
204
|
-
console.log(`[DateModule]
|
|
200
|
+
console.log(`[DateModule] 时间段无效,将被删除: ${timeSlot.start_at} - ${timeSlot.end_at} (资源ID: ${resource.id}, 修正后start_time: ${roundedStartTime})`);
|
|
205
201
|
return null;
|
|
206
202
|
}
|
|
207
203
|
return correctedTimeSlot;
|
|
@@ -23,7 +23,6 @@ __export(types_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(types_exports);
|
|
25
25
|
var DateHooks = /* @__PURE__ */ ((DateHooks2) => {
|
|
26
|
-
return DateHooks2;
|
|
27
26
|
})(DateHooks || {});
|
|
28
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
28
|
0 && (module.exports = {
|
|
@@ -37,16 +37,11 @@ var import_BaseModule = require("../BaseModule");
|
|
|
37
37
|
var import_types = require("./types");
|
|
38
38
|
var import_decimal = __toESM(require("decimal.js"));
|
|
39
39
|
var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
40
|
-
defaultName = "discount";
|
|
41
|
-
defaultVersion = "1.0.0";
|
|
42
|
-
request;
|
|
43
|
-
window;
|
|
44
|
-
store;
|
|
45
|
-
cacheId;
|
|
46
|
-
openCache = false;
|
|
47
|
-
fatherModule;
|
|
48
40
|
constructor(name, version) {
|
|
49
41
|
super(name, version);
|
|
42
|
+
this.defaultName = "discount";
|
|
43
|
+
this.defaultVersion = "1.0.0";
|
|
44
|
+
this.openCache = false;
|
|
50
45
|
}
|
|
51
46
|
async initialize(core, options) {
|
|
52
47
|
var _a, _b, _c, _d;
|
|
@@ -72,10 +67,10 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
72
67
|
this.request = core.getPlugin("request");
|
|
73
68
|
this.window = core.getPlugin("window");
|
|
74
69
|
if (!this.request) {
|
|
75
|
-
throw new Error("discount
|
|
70
|
+
throw new Error("discount模块需要 request 插件支持");
|
|
76
71
|
}
|
|
77
72
|
if (!this.window) {
|
|
78
|
-
throw new Error("discount
|
|
73
|
+
throw new Error("discount模块需要 window 插件支持");
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
76
|
async setDiscountList(discountList) {
|
|
@@ -189,8 +184,8 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
189
184
|
async destroy() {
|
|
190
185
|
this.store.discountList = [];
|
|
191
186
|
this.core.effects.offByModuleDestroy(this.name);
|
|
192
|
-
await this.core.effects.emit(
|
|
193
|
-
console.log("[Discount]
|
|
187
|
+
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
188
|
+
console.log("[Discount] 已销毁");
|
|
194
189
|
}
|
|
195
190
|
async clear() {
|
|
196
191
|
this.store.discountList = [];
|
|
@@ -25,13 +25,13 @@ module.exports = __toCommonJS(Guests_exports);
|
|
|
25
25
|
var import_BaseModule = require("../BaseModule");
|
|
26
26
|
var import_types = require("./types");
|
|
27
27
|
var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
28
|
-
defaultName = "guestList";
|
|
29
|
-
defaultVersion = "1.0.0";
|
|
30
|
-
state = {
|
|
31
|
-
list: []
|
|
32
|
-
};
|
|
33
28
|
constructor(name, version) {
|
|
34
29
|
super(name, version);
|
|
30
|
+
this.defaultName = "guestList";
|
|
31
|
+
this.defaultVersion = "1.0.0";
|
|
32
|
+
this.state = {
|
|
33
|
+
list: []
|
|
34
|
+
};
|
|
35
35
|
}
|
|
36
36
|
async initialize(core, options) {
|
|
37
37
|
this.core = core;
|
|
@@ -41,12 +41,13 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
|
41
41
|
}
|
|
42
42
|
async addGuest(guest) {
|
|
43
43
|
this.state.list.push(guest);
|
|
44
|
-
await this.core.effects.emit(
|
|
45
|
-
await this.core.effects.emit(
|
|
44
|
+
await this.core.effects.emit(`${this.name}:onGuestAdd`, guest);
|
|
45
|
+
await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
|
|
46
46
|
}
|
|
47
47
|
async updateGuest(id, updates) {
|
|
48
48
|
const index = this.state.list.findIndex((g) => g.id === id);
|
|
49
|
-
if (index === -1)
|
|
49
|
+
if (index === -1)
|
|
50
|
+
return;
|
|
50
51
|
this.state.list[index] = {
|
|
51
52
|
...this.state.list[index],
|
|
52
53
|
...updates
|
|
@@ -55,14 +56,15 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
|
55
56
|
import_types.GuestHooks.OnGuestUpdate,
|
|
56
57
|
this.state.list[index]
|
|
57
58
|
);
|
|
58
|
-
await this.core.effects.emit(
|
|
59
|
+
await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
|
|
59
60
|
}
|
|
60
61
|
async removeGuest(id) {
|
|
61
62
|
const index = this.state.list.findIndex((g) => g.id === id);
|
|
62
|
-
if (index === -1)
|
|
63
|
+
if (index === -1)
|
|
64
|
+
return;
|
|
63
65
|
const [removed] = this.state.list.splice(index, 1);
|
|
64
|
-
await this.core.effects.emit(
|
|
65
|
-
await this.core.effects.emit(
|
|
66
|
+
await this.core.effects.emit(`${this.name}:onGuestRemove`, removed);
|
|
67
|
+
await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
|
|
66
68
|
}
|
|
67
69
|
async getGuests() {
|
|
68
70
|
return this.state.list;
|
|
@@ -72,19 +74,22 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
|
72
74
|
}
|
|
73
75
|
async addItemToGuest(guestId, item) {
|
|
74
76
|
const guest = this.state.list.find((g) => g.id === guestId);
|
|
75
|
-
if (!guest)
|
|
77
|
+
if (!guest)
|
|
78
|
+
return;
|
|
76
79
|
guest.items.push(item);
|
|
77
|
-
await this.core.effects.emit(
|
|
78
|
-
await this.core.effects.emit(
|
|
80
|
+
await this.core.effects.emit(`${this.name}:onGuestUpdate`, guest);
|
|
81
|
+
await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
|
|
79
82
|
}
|
|
80
83
|
async removeItemFromGuest(guestId, itemId) {
|
|
81
84
|
const guest = this.state.list.find((g) => g.id === guestId);
|
|
82
|
-
if (!guest)
|
|
85
|
+
if (!guest)
|
|
86
|
+
return;
|
|
83
87
|
const index = guest.items.findIndex((i) => i.id === itemId);
|
|
84
|
-
if (index === -1)
|
|
88
|
+
if (index === -1)
|
|
89
|
+
return;
|
|
85
90
|
guest.items.splice(index, 1);
|
|
86
|
-
await this.core.effects.emit(
|
|
87
|
-
await this.core.effects.emit(
|
|
91
|
+
await this.core.effects.emit(`${this.name}:onGuestUpdate`, guest);
|
|
92
|
+
await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
|
|
88
93
|
}
|
|
89
94
|
};
|
|
90
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -37,14 +37,11 @@ var import_utils = require("./utils");
|
|
|
37
37
|
var import_utils2 = require("../Product/utils");
|
|
38
38
|
var import_dayjs = __toESM(require("dayjs"));
|
|
39
39
|
var OrderModule = class extends import_BaseModule.BaseModule {
|
|
40
|
-
defaultName = "order";
|
|
41
|
-
defaultVersion = "1.0.0";
|
|
42
|
-
store;
|
|
43
|
-
request;
|
|
44
|
-
logger;
|
|
45
40
|
// LoggerManager 实例
|
|
46
41
|
constructor(name, version) {
|
|
47
42
|
super(name, version);
|
|
43
|
+
this.defaultName = "order";
|
|
44
|
+
this.defaultVersion = "1.0.0";
|
|
48
45
|
}
|
|
49
46
|
async initialize(core, options) {
|
|
50
47
|
this.core = core;
|
|
@@ -52,10 +49,11 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
52
49
|
this.request = this.core.getPlugin("request");
|
|
53
50
|
const appPlugin = this.core.getPlugin("app");
|
|
54
51
|
if (!appPlugin) {
|
|
55
|
-
console.warn("Order
|
|
52
|
+
console.warn("Order 模块需要 app 插件支持");
|
|
56
53
|
}
|
|
57
54
|
const app = appPlugin == null ? void 0 : appPlugin.getApp();
|
|
58
|
-
if (app)
|
|
55
|
+
if (app)
|
|
56
|
+
this.logger = app.logger;
|
|
59
57
|
this.logInfo("OrderModule initialized successfully");
|
|
60
58
|
}
|
|
61
59
|
/**
|
|
@@ -208,7 +206,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
208
206
|
orderIdIncluded: params.order_id,
|
|
209
207
|
paymentMethods: ((_d = params.payments) == null ? void 0 : _d.map((p) => p.code)) || []
|
|
210
208
|
});
|
|
211
|
-
console.log("[Order] createOrderByCheckout
|
|
209
|
+
console.log("[Order] createOrderByCheckout 开始创建订单:", {
|
|
212
210
|
type: params.type,
|
|
213
211
|
platform: params.platform,
|
|
214
212
|
is_deposit: params.is_deposit,
|
|
@@ -238,7 +236,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
238
236
|
if (!params.order_id && !orderData.schedule_date) {
|
|
239
237
|
orderData.schedule_date = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
240
238
|
}
|
|
241
|
-
console.log("[Order]
|
|
239
|
+
console.log("[Order] 调用后端接口创建订单:", {
|
|
242
240
|
url: "/order/checkout",
|
|
243
241
|
orderType: orderData.type,
|
|
244
242
|
platform: orderData.platform,
|
|
@@ -276,13 +274,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
276
274
|
this.logInfo("Order API called successfully", {
|
|
277
275
|
response
|
|
278
276
|
});
|
|
279
|
-
console.log("[Order]
|
|
277
|
+
console.log("[Order] 订单创建成功,后端响应:", {
|
|
280
278
|
success: !!response,
|
|
281
279
|
hasOrderId: !!(((_q = response == null ? void 0 : response.data) == null ? void 0 : _q.order_id) || (response == null ? void 0 : response.order_id))
|
|
282
280
|
});
|
|
283
281
|
return response;
|
|
284
282
|
} catch (error) {
|
|
285
|
-
console.error("[Order] createOrderByCheckout
|
|
283
|
+
console.error("[Order] createOrderByCheckout 创建订单失败:", error);
|
|
286
284
|
this.logInfo("Order API called failed", {
|
|
287
285
|
error: error instanceof Error ? error.message : String(error)
|
|
288
286
|
});
|
|
@@ -30,7 +30,7 @@ var CashPaymentImpl = class {
|
|
|
30
30
|
async processCashPayment(amount, orderUuid) {
|
|
31
31
|
const cashMethod = await this.paymentModule.getCashPaymentMethod();
|
|
32
32
|
if (!cashMethod) {
|
|
33
|
-
throw new Error("
|
|
33
|
+
throw new Error("现金支付方式未找到");
|
|
34
34
|
}
|
|
35
35
|
const paymentItem = {
|
|
36
36
|
amount: amount.toString(),
|
|
@@ -213,7 +213,7 @@ function recommendOptimalPayments(targetAmount, denominations) {
|
|
|
213
213
|
}
|
|
214
214
|
return finalResults.sort((a, b) => a - b);
|
|
215
215
|
} catch (error) {
|
|
216
|
-
console.warn("
|
|
216
|
+
console.warn("推荐支付金额计算出错:", error);
|
|
217
217
|
const safeAmount = Math.ceil(targetAmount);
|
|
218
218
|
return [targetAmount, safeAmount];
|
|
219
219
|
}
|
|
@@ -29,7 +29,7 @@ var EftposPaymentImpl = class {
|
|
|
29
29
|
async processEftposPayment(amount, orderUuid) {
|
|
30
30
|
const eftposMethod = await this.paymentModule.getEftposPaymentMethod();
|
|
31
31
|
if (!eftposMethod) {
|
|
32
|
-
throw new Error("Eftpos
|
|
32
|
+
throw new Error("Eftpos支付方式未找到");
|
|
33
33
|
}
|
|
34
34
|
const paymentItem = {
|
|
35
35
|
amount: amount.toString(),
|