@pisell/pisellos 0.0.373 → 0.0.376
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/model/strategy/adapter/walletPass/utils.js +7 -2
- package/dist/model/strategy/type.d.ts +1 -1
- package/dist/modules/Customer/types.d.ts +1 -1
- package/dist/modules/Payment/index.js +35 -7
- package/dist/modules/Payment/types.d.ts +9 -7
- package/dist/modules/Product/index.d.ts +1 -1
- 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 +2 -2
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/Checkout/index.js +31 -2
- package/dist/solution/Checkout/types.d.ts +2 -0
- 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/model/strategy/adapter/walletPass/evaluator.js +2 -3
- package/lib/model/strategy/adapter/walletPass/example.js +21 -21
- package/lib/model/strategy/adapter/walletPass/index.js +4 -2
- package/lib/model/strategy/adapter/walletPass/locales.js +10 -10
- package/lib/model/strategy/adapter/walletPass/utils.js +9 -4
- package/lib/model/strategy/index.js +10 -7
- package/lib/model/strategy/strategy-example.js +19 -19
- package/lib/model/strategy/type.d.ts +1 -1
- 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 +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 +94 -86
- package/lib/modules/Payment/types.d.ts +9 -7
- package/lib/modules/Payment/utils.js +6 -3
- package/lib/modules/Payment/walletpass.js +33 -33
- package/lib/modules/Product/index.d.ts +1 -1
- 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 +21 -16
- 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 +2 -2
- package/lib/solution/BookingByStep/index.js +129 -86
- 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 +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 +233 -217
- package/lib/solution/Checkout/types.d.ts +2 -0
- 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/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 +18 -17
|
@@ -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) {
|
|
@@ -191,7 +186,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
191
186
|
this.store.discountList = [];
|
|
192
187
|
this.core.effects.offByModuleDestroy(this.name);
|
|
193
188
|
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
194
|
-
console.log("[Discount]
|
|
189
|
+
console.log("[Discount] 已销毁");
|
|
195
190
|
}
|
|
196
191
|
async clear() {
|
|
197
192
|
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,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
|
/**
|
|
@@ -213,7 +211,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
213
211
|
orderIdIncluded: params.order_id,
|
|
214
212
|
paymentMethods: ((_d = params.payments) == null ? void 0 : _d.map((p) => p.code)) || []
|
|
215
213
|
});
|
|
216
|
-
console.log("[Order] createOrderByCheckout
|
|
214
|
+
console.log("[Order] createOrderByCheckout 开始创建订单:", {
|
|
217
215
|
type: params.type,
|
|
218
216
|
platform: params.platform,
|
|
219
217
|
is_deposit: params.is_deposit,
|
|
@@ -243,7 +241,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
243
241
|
if (!params.order_id && !orderData.schedule_date) {
|
|
244
242
|
orderData.schedule_date = (0, import_dayjs.default)().format("YYYY-MM-DD HH:mm:ss");
|
|
245
243
|
}
|
|
246
|
-
console.log("[Order]
|
|
244
|
+
console.log("[Order] 调用后端接口创建订单:", {
|
|
247
245
|
url: "/order/checkout",
|
|
248
246
|
orderType: orderData.type,
|
|
249
247
|
platform: orderData.platform,
|
|
@@ -281,13 +279,13 @@ var OrderModule = class extends import_BaseModule.BaseModule {
|
|
|
281
279
|
this.logInfo("Order API called successfully", {
|
|
282
280
|
response
|
|
283
281
|
});
|
|
284
|
-
console.log("[Order]
|
|
282
|
+
console.log("[Order] 订单创建成功,后端响应:", {
|
|
285
283
|
success: !!response,
|
|
286
284
|
hasOrderId: !!(((_q = response == null ? void 0 : response.data) == null ? void 0 : _q.order_id) || (response == null ? void 0 : response.order_id))
|
|
287
285
|
});
|
|
288
286
|
return response;
|
|
289
287
|
} catch (error) {
|
|
290
|
-
console.error("[Order] createOrderByCheckout
|
|
288
|
+
console.error("[Order] createOrderByCheckout 创建订单失败:", error);
|
|
291
289
|
this.logInfo("Order API called failed", {
|
|
292
290
|
error: error instanceof Error ? error.message : String(error)
|
|
293
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(),
|