@pisell/pisellos 2.1.100 → 2.1.101
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/Customer/types.d.ts +1 -1
- package/dist/modules/Payment/types.d.ts +7 -7
- package/dist/modules/Rules/types.d.ts +1 -1
- package/dist/modules/Schedule/getDateIsInSchedule.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/utils/resources.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.d.ts +2 -2
- 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 +10 -9
- package/lib/modules/AccountList/index.js +11 -14
- package/lib/modules/BaseModule.js +3 -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 +15 -18
- 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 +6 -11
- package/lib/modules/Guests/index.js +15 -10
- package/lib/modules/Order/index.js +7 -10
- 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 +73 -84
- package/lib/modules/Payment/types.d.ts +7 -7
- package/lib/modules/Payment/utils.js +6 -3
- package/lib/modules/Payment/walletpass.js +31 -31
- package/lib/modules/Product/index.js +5 -6
- package/lib/modules/ProductList/index.js +3 -5
- package/lib/modules/Resource/index.js +12 -8
- package/lib/modules/Rules/index.js +35 -21
- package/lib/modules/Rules/types.d.ts +1 -1
- package/lib/modules/Schedule/getDateIsInSchedule.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/modules/Summary/utils.js +16 -8
- 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 +177 -110
- package/lib/solution/BookingByStep/utils/capacity.js +16 -11
- 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 +14 -19
- 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 +15 -15
- package/lib/solution/Checkout/index.js +211 -216
- package/lib/solution/Checkout/utils/index.js +22 -18
- package/lib/solution/RegisterAndLogin/config.js +2 -2
- package/lib/solution/RegisterAndLogin/index.js +110 -114
- package/lib/solution/RegisterAndLogin/utils.js +9 -9
- package/lib/solution/ShopDiscount/index.js +13 -16
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +2 -2
- package/lib/solution/ShopDiscount/utils.js +2 -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 +17 -16
|
@@ -28,26 +28,23 @@ var import_BaseModule = require("../BaseModule");
|
|
|
28
28
|
var import_constants = require("./constants");
|
|
29
29
|
__reExport(Customer_exports, require("./types"), module.exports);
|
|
30
30
|
var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
31
|
-
defaultName = "customer";
|
|
32
|
-
defaultVersion = "1.0.0";
|
|
33
|
-
store = {
|
|
34
|
-
customerList: [],
|
|
35
|
-
selectedCustomer: null,
|
|
36
|
-
total: 0,
|
|
37
|
-
currentPage: 1,
|
|
38
|
-
pageSize: import_constants.DEFAULT_PAGE_SIZE,
|
|
39
|
-
loading: false,
|
|
40
|
-
error: null,
|
|
41
|
-
hasMore: true,
|
|
42
|
-
loadingMore: false,
|
|
43
|
-
searchParams: {}
|
|
44
|
-
};
|
|
45
|
-
request;
|
|
46
|
-
cacheId;
|
|
47
|
-
openCache = false;
|
|
48
|
-
fatherModule;
|
|
49
31
|
constructor(name, version) {
|
|
50
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;
|
|
51
48
|
}
|
|
52
49
|
async initialize(core, options) {
|
|
53
50
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
@@ -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;
|
|
@@ -201,13 +197,13 @@ var DateModule = class extends import_BaseModule.BaseModule {
|
|
|
201
197
|
if (startAt.isBefore(resourceStartTime)) {
|
|
202
198
|
const roundedStartTime = this.roundUpToNext10Minutes(resourceStartTime);
|
|
203
199
|
const roundedStartTimeDayjs = (0, import_dayjs.default)(roundedStartTime);
|
|
204
|
-
console.log(`[DateModule]
|
|
200
|
+
console.log(`[DateModule] 修正时间段开始时间: ${timeSlot.start_at} -> ${roundedStartTime} (资源ID: ${resource.id}, 原始start_time: ${resource.start_time})`);
|
|
205
201
|
const correctedTimeSlot = {
|
|
206
202
|
...timeSlot,
|
|
207
203
|
start_at: roundedStartTime
|
|
208
204
|
};
|
|
209
205
|
if (endAt.isBefore(roundedStartTimeDayjs)) {
|
|
210
|
-
console.log(`[DateModule]
|
|
206
|
+
console.log(`[DateModule] 时间段无效,将被删除: ${timeSlot.start_at} - ${timeSlot.end_at} (资源ID: ${resource.id}, 修正后start_time: ${roundedStartTime})`);
|
|
211
207
|
return null;
|
|
212
208
|
}
|
|
213
209
|
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) {
|
|
@@ -201,7 +196,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
201
196
|
this.store.discountList = [];
|
|
202
197
|
this.core.effects.offByModuleDestroy(this.name);
|
|
203
198
|
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
204
|
-
console.log("[Discount]
|
|
199
|
+
console.log("[Discount] 已销毁");
|
|
205
200
|
}
|
|
206
201
|
async clear() {
|
|
207
202
|
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;
|
|
@@ -46,7 +46,8 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
|
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
|
|
@@ -59,7 +60,8 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
|
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
66
|
await this.core.effects.emit(`${this.name}:onGuestRemove`, removed);
|
|
65
67
|
await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
|
|
@@ -72,16 +74,19 @@ 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
80
|
await this.core.effects.emit(`${this.name}:onGuestUpdate`, guest);
|
|
78
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
91
|
await this.core.effects.emit(`${this.name}:onGuestUpdate`, guest);
|
|
87
92
|
await this.core.effects.emit(`${this.name}:onGuestChange`, this.state.list);
|
|
@@ -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 || "order", 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,7 +49,7 @@ 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
|
-
throw new Error("Order
|
|
52
|
+
throw new Error("Order 模块需要 app 插件支持");
|
|
56
53
|
}
|
|
57
54
|
const app = appPlugin.getApp();
|
|
58
55
|
this.logger = app.logger;
|
|
@@ -214,7 +211,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
214
211
|
orderIdIncluded: params.order_id,
|
|
215
212
|
paymentMethods: ((_d = params.payments) == null ? void 0 : _d.map((p) => p.code)) || []
|
|
216
213
|
});
|
|
217
|
-
console.log("[Order] createOrderByCheckout
|
|
214
|
+
console.log("[Order] createOrderByCheckout 开始创建订单:", {
|
|
218
215
|
type: params.type,
|
|
219
216
|
platform: params.platform,
|
|
220
217
|
is_deposit: params.is_deposit,
|
|
@@ -244,7 +241,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
244
241
|
if (!params.order_id && !orderData.schedule_date) {
|
|
245
242
|
orderData.schedule_date = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
246
243
|
}
|
|
247
|
-
console.log("[Order]
|
|
244
|
+
console.log("[Order] 调用后端接口创建订单:", {
|
|
248
245
|
url: "/order/checkout",
|
|
249
246
|
orderType: orderData.type,
|
|
250
247
|
platform: orderData.platform,
|
|
@@ -282,13 +279,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
282
279
|
this.logInfo("Order API called successfully", {
|
|
283
280
|
response
|
|
284
281
|
});
|
|
285
|
-
console.log("[Order]
|
|
282
|
+
console.log("[Order] 订单创建成功,后端响应:", {
|
|
286
283
|
success: !!response,
|
|
287
284
|
hasOrderId: !!(((_q = response == null ? void 0 : response.data) == null ? void 0 : _q.order_id) || (response == null ? void 0 : response.order_id))
|
|
288
285
|
});
|
|
289
286
|
return response;
|
|
290
287
|
} catch (error) {
|
|
291
|
-
console.error("[Order] createOrderByCheckout
|
|
288
|
+
console.error("[Order] createOrderByCheckout 创建订单失败:", error);
|
|
292
289
|
this.logInfo("Order API called failed", {
|
|
293
290
|
error: error instanceof Error ? error.message : String(error)
|
|
294
291
|
});
|
|
@@ -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(),
|