@pisell/pisellos 0.0.207 → 0.0.208
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 +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 +1 -0
- package/dist/solution/BookingByStep/index.js +8 -5
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/ShopDiscount/types.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.js +28 -27
- package/lib/effects/index.d.ts +1 -1
- 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/Date/index.js +4 -8
- 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 +2 -4
- package/lib/modules/Payment/cash.js +1 -1
- package/lib/modules/Payment/eftpos.js +1 -1
- package/lib/modules/Payment/index.js +86 -98
- package/lib/modules/Payment/wallet.js +1 -1
- package/lib/modules/Product/index.js +5 -6
- package/lib/modules/ProductList/index.js +4 -5
- package/lib/modules/Resource/index.js +12 -8
- package/lib/modules/Rules/index.js +13 -10
- 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 -0
- package/lib/solution/BookingByStep/index.js +77 -52
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingByStep/utils/resources.js +8 -4
- package/lib/solution/BookingByStep/utils/timeslots.js +12 -6
- package/lib/solution/BuyTickets/index.js +15 -15
- package/lib/solution/ShopDiscount/index.js +11 -15
- package/lib/solution/ShopDiscount/types.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -67,10 +62,10 @@ var DiscountModule = 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("discount
|
|
65
|
+
throw new Error("discount模块需要 request 插件支持");
|
|
71
66
|
}
|
|
72
67
|
if (!this.window) {
|
|
73
|
-
throw new Error("discount
|
|
68
|
+
throw new Error("discount模块需要 window 插件支持");
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
71
|
async setDiscountList(discountList) {
|
|
@@ -135,7 +130,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
135
130
|
this.store.discountList = [];
|
|
136
131
|
this.core.effects.offByModuleDestroy(this.name);
|
|
137
132
|
await this.core.effects.emit(import_types.DiscountHooks.OnDestroy, {});
|
|
138
|
-
console.log("[Discount]
|
|
133
|
+
console.log("[Discount] 已销毁");
|
|
139
134
|
}
|
|
140
135
|
async clear() {
|
|
141
136
|
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(import_types.GuestHooks.OnGuestRemove, removed);
|
|
65
67
|
await this.core.effects.emit(import_types.GuestHooks.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(import_types.GuestHooks.OnGuestUpdate, guest);
|
|
78
81
|
await this.core.effects.emit(import_types.GuestHooks.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(import_types.GuestHooks.OnGuestUpdate, guest);
|
|
87
92
|
await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
|
|
@@ -26,12 +26,10 @@ var import_BaseModule = require("../BaseModule");
|
|
|
26
26
|
var import_utils = require("./utils");
|
|
27
27
|
var import_utils2 = require("../Product/utils");
|
|
28
28
|
var OrderModule = class extends import_BaseModule.BaseModule {
|
|
29
|
-
defaultName = "order";
|
|
30
|
-
defaultVersion = "1.0.0";
|
|
31
|
-
store;
|
|
32
|
-
request;
|
|
33
29
|
constructor(name, version) {
|
|
34
30
|
super(name, version);
|
|
31
|
+
this.defaultName = "order";
|
|
32
|
+
this.defaultVersion = "1.0.0";
|
|
35
33
|
}
|
|
36
34
|
async initialize(core, options) {
|
|
37
35
|
this.core = core;
|
|
@@ -29,7 +29,7 @@ var CashPaymentImpl = class {
|
|
|
29
29
|
async processCashPayment(amount, orderUuid) {
|
|
30
30
|
const cashMethod = await this.paymentModule.getCashPaymentMethod();
|
|
31
31
|
if (!cashMethod) {
|
|
32
|
-
throw new Error("
|
|
32
|
+
throw new Error("现金支付方式未找到");
|
|
33
33
|
}
|
|
34
34
|
const paymentItem = {
|
|
35
35
|
amount: amount.toString(),
|
|
@@ -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(),
|