@pisell/pisellos 2.1.35 → 2.1.36
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 +0 -1
- package/dist/effects/index.js +6 -29
- package/dist/modules/Account/index.js +3 -2
- package/dist/modules/BaseModule.d.ts +0 -3
- package/dist/modules/BaseModule.js +0 -15
- package/dist/modules/Customer/index.js +10 -9
- package/dist/modules/Customer/types.d.ts +2 -2
- package/dist/modules/Customer/types.js +2 -2
- package/dist/modules/Discount/index.js +1 -1
- package/dist/modules/Guests/index.js +9 -9
- package/dist/modules/Order/index.js +1 -1
- package/dist/modules/Payment/index.js +17 -17
- package/dist/modules/Payment/walletpass.js +1 -4
- package/dist/modules/ProductList/index.js +3 -2
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +3 -2
- package/dist/solution/BookingByStep/index.js +3 -3
- package/dist/solution/BookingTicket/index.d.ts +0 -4
- package/dist/solution/BookingTicket/index.js +8 -17
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -4
- package/dist/solution/BookingTicket/utils/scan/index.js +16 -25
- package/dist/solution/BuyTickets/index.js +8 -7
- package/dist/solution/Checkout/index.js +35 -35
- package/dist/solution/ShopDiscount/index.js +10 -9
- package/dist/types/index.d.ts +0 -1
- package/lib/effects/index.d.ts +0 -1
- package/lib/effects/index.js +0 -13
- package/lib/modules/Account/index.js +3 -2
- package/lib/modules/BaseModule.d.ts +0 -3
- package/lib/modules/BaseModule.js +0 -9
- package/lib/modules/Customer/index.js +10 -9
- package/lib/modules/Customer/types.d.ts +2 -2
- package/lib/modules/Customer/types.js +2 -2
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Order/index.js +1 -1
- package/lib/modules/Payment/index.js +16 -16
- package/lib/modules/Payment/walletpass.js +1 -3
- package/lib/modules/ProductList/index.js +3 -2
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +3 -2
- package/lib/solution/BookingByStep/index.js +2 -2
- package/lib/solution/BookingTicket/index.d.ts +0 -4
- package/lib/solution/BookingTicket/index.js +6 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -4
- package/lib/solution/BookingTicket/utils/scan/index.js +1 -7
- package/lib/solution/BuyTickets/index.js +8 -7
- package/lib/solution/Checkout/index.js +34 -34
- package/lib/solution/ShopDiscount/index.js +11 -10
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
|
@@ -24,6 +24,7 @@ __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");
|
|
27
28
|
__reExport(Account_exports, require("./types"), module.exports);
|
|
28
29
|
var AccountModule = class extends import_BaseModule.BaseModule {
|
|
29
30
|
constructor(name, version) {
|
|
@@ -58,7 +59,7 @@ var AccountModule = class extends import_BaseModule.BaseModule {
|
|
|
58
59
|
};
|
|
59
60
|
this.store.accountInfo = account;
|
|
60
61
|
this.store.isLoggedIn = true;
|
|
61
|
-
await this.core.effects.emit(
|
|
62
|
+
await this.core.effects.emit(import_types.AccountHooks.OnLogin, account);
|
|
62
63
|
}
|
|
63
64
|
getCurrentAccount() {
|
|
64
65
|
return this.store.accountInfo;
|
|
@@ -71,7 +72,7 @@ var AccountModule = class extends import_BaseModule.BaseModule {
|
|
|
71
72
|
...updates
|
|
72
73
|
};
|
|
73
74
|
await this.core.effects.emit(
|
|
74
|
-
|
|
75
|
+
import_types.AccountHooks.OnProfileUpdate,
|
|
75
76
|
this.store.accountInfo
|
|
76
77
|
);
|
|
77
78
|
}
|
|
@@ -14,7 +14,4 @@ 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;
|
|
20
17
|
}
|
|
@@ -82,15 +82,6 @@ var BaseModule = class {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
effectsOn(eventType, callback) {
|
|
86
|
-
return this.core.effects.on(`${this.name}:${eventType}`, callback);
|
|
87
|
-
}
|
|
88
|
-
effectsOff(eventType, callback) {
|
|
89
|
-
return this.core.effects.off(`${this.name}:${eventType}`, callback);
|
|
90
|
-
}
|
|
91
|
-
effectsOnce(eventType, callback) {
|
|
92
|
-
return this.core.effects.once(`${this.name}:${eventType}`, callback);
|
|
93
|
-
}
|
|
94
85
|
};
|
|
95
86
|
// Annotate the CommonJS export names for ESM import in node:
|
|
96
87
|
0 && (module.exports = {
|
|
@@ -25,6 +25,7 @@ __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");
|
|
28
29
|
var import_constants = require("./constants");
|
|
29
30
|
__reExport(Customer_exports, require("./types"), module.exports);
|
|
30
31
|
var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
@@ -127,7 +128,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
127
128
|
console.error(`Failed to ${operation}:`, error);
|
|
128
129
|
this.store.error = error instanceof Error ? error.message : `Failed to ${operation}`;
|
|
129
130
|
await this.core.effects.emit(
|
|
130
|
-
|
|
131
|
+
import_types.CustomerHooks.OnCustomerListError,
|
|
131
132
|
this.store.error
|
|
132
133
|
);
|
|
133
134
|
}
|
|
@@ -149,7 +150,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
149
150
|
this.store.hasMore = page * pageSize < total;
|
|
150
151
|
this.store.customerList = (0, import_lodash_es.cloneDeep)(customerList);
|
|
151
152
|
await this.core.effects.emit(
|
|
152
|
-
|
|
153
|
+
import_types.CustomerHooks.OnCustomerListUpdate,
|
|
153
154
|
this.store
|
|
154
155
|
);
|
|
155
156
|
this.triggerPaginationChange({
|
|
@@ -192,7 +193,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
192
193
|
setSelectedCustomer(customer) {
|
|
193
194
|
this.store.selectedCustomer = !customer ? import_constants.DEFAULT_CUSTOMER : (0, import_lodash_es.cloneDeep)(customer);
|
|
194
195
|
this.core.effects.emit(
|
|
195
|
-
|
|
196
|
+
import_types.CustomerHooks.OnCustomerSelected,
|
|
196
197
|
this.store.selectedCustomer
|
|
197
198
|
);
|
|
198
199
|
this.storeChange();
|
|
@@ -232,7 +233,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
232
233
|
this.store.loadingMore = false;
|
|
233
234
|
this.store.searchParams = {};
|
|
234
235
|
this.core.effects.emit(
|
|
235
|
-
|
|
236
|
+
import_types.CustomerHooks.OnCustomerListUpdate,
|
|
236
237
|
this.store
|
|
237
238
|
);
|
|
238
239
|
this.storeChange();
|
|
@@ -246,7 +247,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
246
247
|
this.store.customerList = [newCustomer, ...this.store.customerList];
|
|
247
248
|
this.store.total += 1;
|
|
248
249
|
this.core.effects.emit(
|
|
249
|
-
|
|
250
|
+
import_types.CustomerHooks.OnCustomerListUpdate,
|
|
250
251
|
this.store
|
|
251
252
|
);
|
|
252
253
|
this.storeChange();
|
|
@@ -276,7 +277,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
276
277
|
*/
|
|
277
278
|
triggerPaginationChange(pagination) {
|
|
278
279
|
this.core.effects.emit(
|
|
279
|
-
|
|
280
|
+
import_types.CustomerHooks.OnPaginationChange,
|
|
280
281
|
pagination
|
|
281
282
|
);
|
|
282
283
|
}
|
|
@@ -343,7 +344,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
343
344
|
this.store.total = total;
|
|
344
345
|
this.store.hasMore = page * pageSize < total;
|
|
345
346
|
await this.core.effects.emit(
|
|
346
|
-
|
|
347
|
+
import_types.CustomerHooks.OnScrollLoadMore,
|
|
347
348
|
{
|
|
348
349
|
newCustomers,
|
|
349
350
|
allCustomers: this.store.customerList,
|
|
@@ -352,7 +353,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
352
353
|
}
|
|
353
354
|
);
|
|
354
355
|
await this.core.effects.emit(
|
|
355
|
-
|
|
356
|
+
import_types.CustomerHooks.OnCustomerListUpdate,
|
|
356
357
|
this.store
|
|
357
358
|
);
|
|
358
359
|
this.triggerPaginationChange({
|
|
@@ -394,7 +395,7 @@ var CustomerModule = class extends import_BaseModule.BaseModule {
|
|
|
394
395
|
};
|
|
395
396
|
const response = await this.getCustomerList(resetParams);
|
|
396
397
|
await this.core.effects.emit(
|
|
397
|
-
|
|
398
|
+
import_types.CustomerHooks.OnScrollLoadComplete,
|
|
398
399
|
{
|
|
399
400
|
customers: this.store.customerList,
|
|
400
401
|
total: this.store.total,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ICustomer } from "../AccountList/types";
|
|
2
2
|
export declare enum CustomerHooks {
|
|
3
|
-
OnCustomerListUpdate = "customer:
|
|
3
|
+
OnCustomerListUpdate = "customer:onUpdate",
|
|
4
4
|
OnCustomerListError = "customer:onError",
|
|
5
|
-
OnCustomerSelected = "customer:
|
|
5
|
+
OnCustomerSelected = "customer:onSelected",
|
|
6
6
|
OnPaginationChange = "customer:onPaginationChange",
|
|
7
7
|
OnScrollLoadMore = "customer:onScrollLoadMore",
|
|
8
8
|
OnScrollLoadComplete = "customer:onScrollLoadComplete"
|
|
@@ -23,9 +23,9 @@ __export(types_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(types_exports);
|
|
25
25
|
var CustomerHooks = /* @__PURE__ */ ((CustomerHooks2) => {
|
|
26
|
-
CustomerHooks2["OnCustomerListUpdate"] = "customer:
|
|
26
|
+
CustomerHooks2["OnCustomerListUpdate"] = "customer:onUpdate";
|
|
27
27
|
CustomerHooks2["OnCustomerListError"] = "customer:onError";
|
|
28
|
-
CustomerHooks2["OnCustomerSelected"] = "customer:
|
|
28
|
+
CustomerHooks2["OnCustomerSelected"] = "customer:onSelected";
|
|
29
29
|
CustomerHooks2["OnPaginationChange"] = "customer:onPaginationChange";
|
|
30
30
|
CustomerHooks2["OnScrollLoadMore"] = "customer:onScrollLoadMore";
|
|
31
31
|
CustomerHooks2["OnScrollLoadComplete"] = "customer:onScrollLoadComplete";
|
|
@@ -171,7 +171,7 @@ var DiscountModule = class extends import_BaseModule.BaseModule {
|
|
|
171
171
|
async destroy() {
|
|
172
172
|
this.store.discountList = [];
|
|
173
173
|
this.core.effects.offByModuleDestroy(this.name);
|
|
174
|
-
await this.core.effects.emit(
|
|
174
|
+
await this.core.effects.emit(import_types.DiscountHooks.OnDestroy, {});
|
|
175
175
|
console.log("[Discount] 已销毁");
|
|
176
176
|
}
|
|
177
177
|
async clear() {
|
|
@@ -41,8 +41,8 @@ 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(import_types.GuestHooks.OnGuestAdd, guest);
|
|
45
|
+
await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
|
|
46
46
|
}
|
|
47
47
|
async updateGuest(id, updates) {
|
|
48
48
|
const index = this.state.list.findIndex((g) => g.id === id);
|
|
@@ -56,15 +56,15 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
|
56
56
|
import_types.GuestHooks.OnGuestUpdate,
|
|
57
57
|
this.state.list[index]
|
|
58
58
|
);
|
|
59
|
-
await this.core.effects.emit(
|
|
59
|
+
await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
|
|
60
60
|
}
|
|
61
61
|
async removeGuest(id) {
|
|
62
62
|
const index = this.state.list.findIndex((g) => g.id === id);
|
|
63
63
|
if (index === -1)
|
|
64
64
|
return;
|
|
65
65
|
const [removed] = this.state.list.splice(index, 1);
|
|
66
|
-
await this.core.effects.emit(
|
|
67
|
-
await this.core.effects.emit(
|
|
66
|
+
await this.core.effects.emit(import_types.GuestHooks.OnGuestRemove, removed);
|
|
67
|
+
await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
|
|
68
68
|
}
|
|
69
69
|
async getGuests() {
|
|
70
70
|
return this.state.list;
|
|
@@ -77,8 +77,8 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
|
77
77
|
if (!guest)
|
|
78
78
|
return;
|
|
79
79
|
guest.items.push(item);
|
|
80
|
-
await this.core.effects.emit(
|
|
81
|
-
await this.core.effects.emit(
|
|
80
|
+
await this.core.effects.emit(import_types.GuestHooks.OnGuestUpdate, guest);
|
|
81
|
+
await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
|
|
82
82
|
}
|
|
83
83
|
async removeItemFromGuest(guestId, itemId) {
|
|
84
84
|
const guest = this.state.list.find((g) => g.id === guestId);
|
|
@@ -88,8 +88,8 @@ var GuestListModule = class extends import_BaseModule.BaseModule {
|
|
|
88
88
|
if (index === -1)
|
|
89
89
|
return;
|
|
90
90
|
guest.items.splice(index, 1);
|
|
91
|
-
await this.core.effects.emit(
|
|
92
|
-
await this.core.effects.emit(
|
|
91
|
+
await this.core.effects.emit(import_types.GuestHooks.OnGuestUpdate, guest);
|
|
92
|
+
await this.core.effects.emit(import_types.GuestHooks.OnGuestChange, this.state.list);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -39,7 +39,7 @@ var import_dayjs = __toESM(require("dayjs"));
|
|
|
39
39
|
var OrderModule = class extends import_BaseModule.BaseModule {
|
|
40
40
|
// LoggerManager 实例
|
|
41
41
|
constructor(name, version) {
|
|
42
|
-
super(name
|
|
42
|
+
super(name, version);
|
|
43
43
|
this.defaultName = "order";
|
|
44
44
|
this.defaultVersion = "1.0.0";
|
|
45
45
|
}
|
|
@@ -55,7 +55,7 @@ function generateRequestUniqueId() {
|
|
|
55
55
|
}
|
|
56
56
|
var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
57
57
|
constructor(name, version) {
|
|
58
|
-
super(name
|
|
58
|
+
super(name, version);
|
|
59
59
|
this.defaultName = "pay";
|
|
60
60
|
this.defaultVersion = "1.0.0";
|
|
61
61
|
// LoggerManager 实例
|
|
@@ -193,7 +193,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
193
193
|
console.warn("[PaymentModule] 无法缓存支付方式,pay_method 表不存在");
|
|
194
194
|
}
|
|
195
195
|
await this.core.effects.emit(
|
|
196
|
-
|
|
196
|
+
import_types.PaymentHooks.OnPaymentMethodsLoaded,
|
|
197
197
|
payMethods
|
|
198
198
|
);
|
|
199
199
|
this.logInfo("getPayMethodListAsync completed successfully", {
|
|
@@ -243,7 +243,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
243
243
|
newMethods: newPayMethods
|
|
244
244
|
};
|
|
245
245
|
await this.core.effects.emit(
|
|
246
|
-
|
|
246
|
+
import_types.PaymentHooks.OnPaymentMethodsChanged,
|
|
247
247
|
eventData
|
|
248
248
|
);
|
|
249
249
|
} else {
|
|
@@ -368,7 +368,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
368
368
|
const order = await this.dbManager.get("order", orderUuid);
|
|
369
369
|
if (order) {
|
|
370
370
|
await this.dbManager.delete("order", orderUuid);
|
|
371
|
-
await this.core.effects.emit(
|
|
371
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderDeleted, order);
|
|
372
372
|
console.log("[PaymentModule] 支付订单删除成功:", orderUuid);
|
|
373
373
|
}
|
|
374
374
|
} catch (error) {
|
|
@@ -386,8 +386,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
386
386
|
const updatedOrder = { ...order, ...params };
|
|
387
387
|
this.recalculateOrderAmount(updatedOrder);
|
|
388
388
|
await this.dbManager.update("order", updatedOrder);
|
|
389
|
-
await this.core.effects.emit(
|
|
390
|
-
await this.core.effects.emit(
|
|
389
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderUpdated, updatedOrder);
|
|
390
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
391
391
|
action: "update",
|
|
392
392
|
order: updatedOrder,
|
|
393
393
|
originalOrder: order
|
|
@@ -445,8 +445,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
445
445
|
}
|
|
446
446
|
};
|
|
447
447
|
await this.dbManager.update("order", updatedOrder);
|
|
448
|
-
await this.core.effects.emit(
|
|
449
|
-
await this.core.effects.emit(
|
|
448
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderUpdated, updatedOrder);
|
|
449
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
450
450
|
action: "order_id_replaced",
|
|
451
451
|
order: updatedOrder,
|
|
452
452
|
originalOrder: existingOrder,
|
|
@@ -563,7 +563,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
563
563
|
order.payment.push(newPaymentItem);
|
|
564
564
|
this.recalculateOrderAmount(order);
|
|
565
565
|
await this.dbManager.update("order", order);
|
|
566
|
-
await this.core.effects.emit(
|
|
566
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnPaymentAdded, {
|
|
567
567
|
orderUuid,
|
|
568
568
|
payment: newPaymentItem
|
|
569
569
|
});
|
|
@@ -619,11 +619,11 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
619
619
|
});
|
|
620
620
|
this.recalculateOrderAmount(order);
|
|
621
621
|
await this.dbManager.update("order", order);
|
|
622
|
-
await this.core.effects.emit(
|
|
622
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnPaymentDeleted, {
|
|
623
623
|
order,
|
|
624
624
|
paymentItem
|
|
625
625
|
});
|
|
626
|
-
await this.core.effects.emit(
|
|
626
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
627
627
|
action: "payment_delete",
|
|
628
628
|
order,
|
|
629
629
|
paymentItem
|
|
@@ -700,7 +700,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
700
700
|
await this.addPaymentItemAsync(orderUuid, voucherItem);
|
|
701
701
|
}
|
|
702
702
|
const updatedOrder = await this.getPaymentOrderByUuidAsync(orderUuid);
|
|
703
|
-
await this.core.effects.emit(
|
|
703
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnPaymentAdded, {
|
|
704
704
|
orderUuid,
|
|
705
705
|
order: updatedOrder,
|
|
706
706
|
payment: null
|
|
@@ -741,11 +741,11 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
741
741
|
Object.assign(paymentItem, formattedParams);
|
|
742
742
|
this.recalculateOrderAmount(order);
|
|
743
743
|
await this.dbManager.update("order", order);
|
|
744
|
-
await this.core.effects.emit(
|
|
744
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnPaymentUpdated, {
|
|
745
745
|
order,
|
|
746
746
|
paymentItem
|
|
747
747
|
});
|
|
748
|
-
await this.core.effects.emit(
|
|
748
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
749
749
|
action: "payment_update",
|
|
750
750
|
order,
|
|
751
751
|
paymentItem
|
|
@@ -833,8 +833,8 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
833
833
|
});
|
|
834
834
|
return;
|
|
835
835
|
}
|
|
836
|
-
await this.core.effects.emit(
|
|
837
|
-
await this.core.effects.emit(
|
|
836
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnPaymentSubmitted, order);
|
|
837
|
+
await this.core.effects.emit(import_types.PaymentHooks.OnOrderChanged, {
|
|
838
838
|
action: "submit",
|
|
839
839
|
order
|
|
840
840
|
});
|
|
@@ -38,9 +38,7 @@ var WalletPassPaymentImpl = class {
|
|
|
38
38
|
*/
|
|
39
39
|
emitEvent(hook, data) {
|
|
40
40
|
try {
|
|
41
|
-
|
|
42
|
-
const fullEventName = `${this.paymentModule.name}:${eventName}`;
|
|
43
|
-
this.paymentModule.core.effects.emit(fullEventName, data);
|
|
41
|
+
this.paymentModule.core.effects.emit(hook, data);
|
|
44
42
|
} catch (error) {
|
|
45
43
|
this.paymentModule.logError("[WalletPass] 发送事件失败", error, { hook });
|
|
46
44
|
}
|
|
@@ -24,6 +24,7 @@ __export(ProductList_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(ProductList_exports);
|
|
26
26
|
var import_BaseModule = require("../BaseModule");
|
|
27
|
+
var import_types = require("./types");
|
|
27
28
|
var import_lodash_es = require("lodash-es");
|
|
28
29
|
__reExport(ProductList_exports, require("./types"), module.exports);
|
|
29
30
|
var ProductList = class extends import_BaseModule.BaseModule {
|
|
@@ -133,14 +134,14 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
133
134
|
}
|
|
134
135
|
async getProducts() {
|
|
135
136
|
await this.core.effects.emit(
|
|
136
|
-
|
|
137
|
+
import_types.ProductListHooks.onGetProducts,
|
|
137
138
|
this.store.list
|
|
138
139
|
);
|
|
139
140
|
return (0, import_lodash_es.cloneDeep)(this.store.list);
|
|
140
141
|
}
|
|
141
142
|
async getProduct(id) {
|
|
142
143
|
await this.core.effects.emit(
|
|
143
|
-
|
|
144
|
+
import_types.ProductListHooks.onGetProduct,
|
|
144
145
|
this.store.list
|
|
145
146
|
);
|
|
146
147
|
const product = this.store.list.find((product2) => product2.id === id);
|
|
@@ -42,7 +42,7 @@ var ResourceListModule = class extends import_BaseModule.BaseModule {
|
|
|
42
42
|
if (!resource)
|
|
43
43
|
return;
|
|
44
44
|
this.store.selectedResource = resource;
|
|
45
|
-
await this.core.effects.emit(
|
|
45
|
+
await this.core.effects.emit(import_types.ResourceHooks.OnResourceSelect, resource);
|
|
46
46
|
}
|
|
47
47
|
getSelectedResource() {
|
|
48
48
|
return this.store.selectedResource;
|
|
@@ -33,6 +33,7 @@ __export(Rules_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(Rules_exports);
|
|
35
35
|
var import_BaseModule = require("../BaseModule");
|
|
36
|
+
var import_types = require("./types");
|
|
36
37
|
var import_utils = require("../../solution/ShopDiscount/utils");
|
|
37
38
|
var import_utils2 = require("../Cart/utils");
|
|
38
39
|
var import_decimal = __toESM(require("decimal.js"));
|
|
@@ -51,7 +52,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
51
52
|
}
|
|
52
53
|
async setRulesList(rulesList) {
|
|
53
54
|
this.store.rulesList = rulesList;
|
|
54
|
-
await this.core.effects.emit(
|
|
55
|
+
await this.core.effects.emit(import_types.RulesHooks.OnRulesListChange, rulesList);
|
|
55
56
|
}
|
|
56
57
|
getRulesList() {
|
|
57
58
|
return this.store.rulesList;
|
|
@@ -488,7 +489,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
488
489
|
}
|
|
489
490
|
async destroy() {
|
|
490
491
|
this.core.effects.offByModuleDestroy(this.name);
|
|
491
|
-
await this.core.effects.emit(
|
|
492
|
+
await this.core.effects.emit(import_types.RulesHooks.OnDestroy, {});
|
|
492
493
|
console.log("[Rules] 已销毁");
|
|
493
494
|
}
|
|
494
495
|
async clear() {
|
|
@@ -116,7 +116,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
this.store.schedule.loadAllSchedule();
|
|
119
|
-
this.core.effects.emit(
|
|
119
|
+
this.core.effects.emit(import_types.BookingByStepHooks.onInited, {});
|
|
120
120
|
}
|
|
121
121
|
// 初始化step
|
|
122
122
|
initStep(stepList) {
|
|
@@ -636,7 +636,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
636
636
|
addItemParams.account = account;
|
|
637
637
|
}
|
|
638
638
|
this.addProductCheck({ date });
|
|
639
|
-
if (addItemParams.quantity > 1 && !(0, import_utils5.isNormalProduct)(productData
|
|
639
|
+
if (addItemParams.quantity > 1 && !(0, import_utils5.isNormalProduct)(productData)) {
|
|
640
640
|
for (let i = 0; i < addItemParams.quantity; i++) {
|
|
641
641
|
const newAddItemParams = (0, import_lodash_es.cloneDeep)(addItemParams);
|
|
642
642
|
newAddItemParams.quantity = 1;
|
|
@@ -22,10 +22,6 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
22
22
|
* @returns 商品列表
|
|
23
23
|
*/
|
|
24
24
|
loadProducts(params?: ILoadProductsParams): Promise<any>;
|
|
25
|
-
/**
|
|
26
|
-
* 初始化外设扫码结果监听
|
|
27
|
-
*/
|
|
28
|
-
initPeripheralsListener(): void;
|
|
29
25
|
/**
|
|
30
26
|
* 获取商品列表(不加载到模块中)
|
|
31
27
|
* @returns 商品列表
|
|
@@ -99,7 +99,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
99
99
|
throw new Error(`模块 ${step} 不存在`);
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
-
this.core.effects.emit(
|
|
102
|
+
this.core.effects.emit(import_types.BookingTicketHooks.onInited, {});
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* 获取商品列表
|
|
@@ -115,7 +115,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
115
115
|
...params,
|
|
116
116
|
cacheId: this.cacheId
|
|
117
117
|
});
|
|
118
|
-
this.core.effects.emit(
|
|
118
|
+
this.core.effects.emit(import_types.BookingTicketHooks.onProductsLoaded, result);
|
|
119
119
|
return result;
|
|
120
120
|
} catch (error) {
|
|
121
121
|
console.error("Failed to load products:", error);
|
|
@@ -149,7 +149,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
149
149
|
*/
|
|
150
150
|
setActiveCustomer(customer) {
|
|
151
151
|
this.store.customer.setSelectedCustomer(customer);
|
|
152
|
-
this.core.effects.emit(
|
|
152
|
+
this.core.effects.emit(import_types.BookingTicketHooks.onCustomerSelected, {
|
|
153
153
|
customer
|
|
154
154
|
});
|
|
155
155
|
}
|
|
@@ -168,7 +168,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
168
168
|
const customer = this.store.customer.getCustomerById(customerId);
|
|
169
169
|
if (customer) {
|
|
170
170
|
this.store.customer.setSelectedCustomer(customer);
|
|
171
|
-
this.core.effects.emit(
|
|
171
|
+
this.core.effects.emit(import_types.BookingTicketHooks.onCustomerSelected, {
|
|
172
172
|
customer
|
|
173
173
|
});
|
|
174
174
|
}
|
|
@@ -248,7 +248,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
248
248
|
async loadMoreCustomers() {
|
|
249
249
|
try {
|
|
250
250
|
const result = await this.store.customer.loadMoreCustomers();
|
|
251
|
-
this.core.effects.emit(
|
|
251
|
+
this.core.effects.emit(import_types.BookingTicketHooks.onCustomerListUpdate, result);
|
|
252
252
|
return result;
|
|
253
253
|
} catch (error) {
|
|
254
254
|
console.error("Failed to load more customers:", error);
|
|
@@ -263,7 +263,7 @@ var BookingTicketImpl = class extends import_BaseModule.BaseModule {
|
|
|
263
263
|
async resetAndLoadCustomers(params = {}) {
|
|
264
264
|
try {
|
|
265
265
|
const result = await this.store.customer.resetAndLoadCustomers(params);
|
|
266
|
-
this.core.effects.emit(
|
|
266
|
+
this.core.effects.emit(import_types.BookingTicketHooks.onCustomerListReset, result);
|
|
267
267
|
return result;
|
|
268
268
|
} catch (error) {
|
|
269
269
|
console.error("Failed to reset and load customers:", error);
|
|
@@ -37,15 +37,9 @@ var import_task = __toESM(require("../../../../utils/task"));
|
|
|
37
37
|
var Scan = class {
|
|
38
38
|
constructor(solution, watchKey) {
|
|
39
39
|
this.listenerConfig = /* @__PURE__ */ new Map();
|
|
40
|
+
var _a, _b, _c, _d, _e;
|
|
40
41
|
this.solution = solution;
|
|
41
42
|
this.watchKey = watchKey;
|
|
42
|
-
this.initPeripheralsListener();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* 初始化外设扫码结果监听
|
|
46
|
-
*/
|
|
47
|
-
initPeripheralsListener() {
|
|
48
|
-
var _a, _b, _c, _d, _e;
|
|
49
43
|
(_e = (_d = (_c = (_b = (_a = this.solution) == null ? void 0 : _a.window) == null ? void 0 : _b.interaction) == null ? void 0 : _c.utils) == null ? void 0 : _d.mountFunction) == null ? void 0 : _e.call(
|
|
50
44
|
_d,
|
|
51
45
|
"global",
|
|
@@ -24,6 +24,7 @@ __export(BuyTickets_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(BuyTickets_exports);
|
|
26
26
|
var import_modules = require("../../modules/");
|
|
27
|
+
var import_types = require("./types");
|
|
27
28
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
28
29
|
__reExport(BuyTickets_exports, require("./types"), module.exports);
|
|
29
30
|
var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
@@ -48,7 +49,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
48
49
|
if (this.otherParams.prodctIds) {
|
|
49
50
|
await this.loadProductsByIds(this.otherParams.prodctIds);
|
|
50
51
|
}
|
|
51
|
-
await this.core.effects.emit(
|
|
52
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onInited, {});
|
|
52
53
|
}
|
|
53
54
|
// 通过 ids 获取产品,在当前解决方案下,获取到的就是主商品
|
|
54
55
|
async loadProductsByIds(ids) {
|
|
@@ -68,13 +69,13 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
68
69
|
}
|
|
69
70
|
});
|
|
70
71
|
this.store.mainProducts = mainProducts;
|
|
71
|
-
await this.core.effects.emit(
|
|
72
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onMainProductsLoaded, {});
|
|
72
73
|
}
|
|
73
74
|
// 通过 ids 获取产品,在当前解决方案下,获取到的就是其他商品
|
|
74
75
|
async loadProductsByCategory(categoryId) {
|
|
75
76
|
}
|
|
76
77
|
async destroy() {
|
|
77
|
-
await this.core.effects.emit(
|
|
78
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onDestroy, {});
|
|
78
79
|
console.log("[BuyTickets] 已销毁");
|
|
79
80
|
}
|
|
80
81
|
// 获取当前绑定的所有商品
|
|
@@ -82,7 +83,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
82
83
|
var _a;
|
|
83
84
|
const mainData = await this.store.mainProducts.getProducts() || [];
|
|
84
85
|
const otherData = await ((_a = this.store.otherProducts) == null ? void 0 : _a.getProducts()) || [];
|
|
85
|
-
await this.core.effects.emit(
|
|
86
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.OnGetProducts, [
|
|
86
87
|
...mainData,
|
|
87
88
|
...otherData
|
|
88
89
|
]);
|
|
@@ -101,7 +102,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
101
102
|
}
|
|
102
103
|
// 商品列表页提交
|
|
103
104
|
async listSubmit(data) {
|
|
104
|
-
const res = await this.core.effects.emit(
|
|
105
|
+
const res = await this.core.effects.emit(import_types.BuyTicketsHooks.onListSubmit, {
|
|
105
106
|
...data,
|
|
106
107
|
products: this.getProducts()
|
|
107
108
|
});
|
|
@@ -115,14 +116,14 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
115
116
|
}
|
|
116
117
|
// 购物车提交
|
|
117
118
|
async cartSubmit(data) {
|
|
118
|
-
await this.core.effects.emit(
|
|
119
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onCartSubmit, {
|
|
119
120
|
...data,
|
|
120
121
|
products: this.getProducts()
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
124
|
// 结算提交
|
|
124
125
|
async checkoutSubmit(data) {
|
|
125
|
-
await this.core.effects.emit(
|
|
126
|
+
await this.core.effects.emit(import_types.BuyTicketsHooks.onCheckoutSubmit, {
|
|
126
127
|
...data,
|
|
127
128
|
products: this.getProducts()
|
|
128
129
|
});
|