@pisell/pisellos 0.0.321 → 0.0.325
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/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/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/walletpass.js +4 -1
- package/dist/modules/ProductList/index.js +4 -4
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/solution/BookingByStep/index.js +2 -2
- 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/lib/modules/Account/index.js +2 -3
- package/lib/modules/BaseModule.d.ts +3 -0
- package/lib/modules/BaseModule.js +9 -0
- package/lib/modules/Customer/index.js +9 -10
- package/lib/modules/Discount/index.js +1 -1
- package/lib/modules/Guests/index.js +9 -9
- package/lib/modules/Payment/index.js +17 -17
- package/lib/modules/Payment/walletpass.js +3 -1
- package/lib/modules/ProductList/index.js +4 -4
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +2 -3
- package/lib/solution/BookingByStep/index.js +1 -1
- package/lib/solution/BookingTicket/index.js +6 -6
- package/lib/solution/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/index.js +28 -28
- package/lib/solution/ShopDiscount/index.js +1 -1
- package/package.json +1 -1
|
@@ -33,7 +33,6 @@ __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");
|
|
37
36
|
var import_utils = require("../../solution/ShopDiscount/utils");
|
|
38
37
|
var import_utils2 = require("../Cart/utils");
|
|
39
38
|
var import_decimal = __toESM(require("decimal.js"));
|
|
@@ -52,7 +51,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
52
51
|
}
|
|
53
52
|
async setRulesList(rulesList) {
|
|
54
53
|
this.store.rulesList = rulesList;
|
|
55
|
-
await this.core.effects.emit(
|
|
54
|
+
await this.core.effects.emit(`${this.name}:onRulesListChange`, rulesList);
|
|
56
55
|
}
|
|
57
56
|
getRulesList() {
|
|
58
57
|
return this.store.rulesList;
|
|
@@ -489,7 +488,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
489
488
|
}
|
|
490
489
|
async destroy() {
|
|
491
490
|
this.core.effects.offByModuleDestroy(this.name);
|
|
492
|
-
await this.core.effects.emit(
|
|
491
|
+
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
493
492
|
console.log("[Rules] 已销毁");
|
|
494
493
|
}
|
|
495
494
|
async clear() {
|
|
@@ -115,7 +115,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
this.store.schedule.loadAllSchedule();
|
|
118
|
-
this.core.effects.emit(
|
|
118
|
+
this.core.effects.emit(`${this.name}:onInited`, {});
|
|
119
119
|
}
|
|
120
120
|
// 初始化step
|
|
121
121
|
initStep(stepList) {
|
|
@@ -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(`${this.name}: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(`${this.name}: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(`${this.name}: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(`${this.name}: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(`${this.name}: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(`${this.name}:onCustomerListReset`, result);
|
|
267
267
|
return result;
|
|
268
268
|
} catch (error) {
|
|
269
269
|
console.error("Failed to reset and load customers:", error);
|
|
@@ -24,7 +24,6 @@ __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");
|
|
28
27
|
var import_BaseModule = require("../../modules/BaseModule");
|
|
29
28
|
__reExport(BuyTickets_exports, require("./types"), module.exports);
|
|
30
29
|
var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
@@ -49,7 +48,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
49
48
|
if (this.otherParams.prodctIds) {
|
|
50
49
|
await this.loadProductsByIds(this.otherParams.prodctIds);
|
|
51
50
|
}
|
|
52
|
-
await this.core.effects.emit(
|
|
51
|
+
await this.core.effects.emit(`${this.name}:onInited`, {});
|
|
53
52
|
}
|
|
54
53
|
// 通过 ids 获取产品,在当前解决方案下,获取到的就是主商品
|
|
55
54
|
async loadProductsByIds(ids) {
|
|
@@ -69,13 +68,13 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
70
|
this.store.mainProducts = mainProducts;
|
|
72
|
-
await this.core.effects.emit(
|
|
71
|
+
await this.core.effects.emit(`${this.name}:onMainProductsLoaded`, {});
|
|
73
72
|
}
|
|
74
73
|
// 通过 ids 获取产品,在当前解决方案下,获取到的就是其他商品
|
|
75
74
|
async loadProductsByCategory(categoryId) {
|
|
76
75
|
}
|
|
77
76
|
async destroy() {
|
|
78
|
-
await this.core.effects.emit(
|
|
77
|
+
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
79
78
|
console.log("[BuyTickets] 已销毁");
|
|
80
79
|
}
|
|
81
80
|
// 获取当前绑定的所有商品
|
|
@@ -83,7 +82,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
83
82
|
var _a;
|
|
84
83
|
const mainData = await this.store.mainProducts.getProducts() || [];
|
|
85
84
|
const otherData = await ((_a = this.store.otherProducts) == null ? void 0 : _a.getProducts()) || [];
|
|
86
|
-
await this.core.effects.emit(
|
|
85
|
+
await this.core.effects.emit(`${this.name}:onGetProducts`, [
|
|
87
86
|
...mainData,
|
|
88
87
|
...otherData
|
|
89
88
|
]);
|
|
@@ -102,7 +101,7 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
102
101
|
}
|
|
103
102
|
// 商品列表页提交
|
|
104
103
|
async listSubmit(data) {
|
|
105
|
-
const res = await this.core.effects.emit(
|
|
104
|
+
const res = await this.core.effects.emit(`${this.name}:onListSubmit`, {
|
|
106
105
|
...data,
|
|
107
106
|
products: this.getProducts()
|
|
108
107
|
});
|
|
@@ -116,14 +115,14 @@ var BuyTicketsImpl = class extends import_BaseModule.BaseModule {
|
|
|
116
115
|
}
|
|
117
116
|
// 购物车提交
|
|
118
117
|
async cartSubmit(data) {
|
|
119
|
-
await this.core.effects.emit(
|
|
118
|
+
await this.core.effects.emit(`${this.name}:onCartSubmit`, {
|
|
120
119
|
...data,
|
|
121
120
|
products: this.getProducts()
|
|
122
121
|
});
|
|
123
122
|
}
|
|
124
123
|
// 结算提交
|
|
125
124
|
async checkoutSubmit(data) {
|
|
126
|
-
await this.core.effects.emit(
|
|
125
|
+
await this.core.effects.emit(`${this.name}:onCheckoutSubmit`, {
|
|
127
126
|
...data,
|
|
128
127
|
products: this.getProducts()
|
|
129
128
|
});
|
|
@@ -78,7 +78,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
78
78
|
await this.preloadPaymentMethods();
|
|
79
79
|
await this.cleanupExpiredOrdersAsync();
|
|
80
80
|
console.log("[Checkout] 初始化完成");
|
|
81
|
-
await this.core.effects.emit(
|
|
81
|
+
await this.core.effects.emit(`${this.name}:onCheckoutInitialized`, {
|
|
82
82
|
timestamp: Date.now()
|
|
83
83
|
});
|
|
84
84
|
this.logInfo("CheckoutModule initialized successfully");
|
|
@@ -262,7 +262,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
262
262
|
this.logInfo("initWalletData currentOrder found", {
|
|
263
263
|
currentOrder: this.store.currentOrder
|
|
264
264
|
});
|
|
265
|
-
await this.core.effects.emit(
|
|
265
|
+
await this.core.effects.emit(`${this.name}:onWalletDataInitialized`, {
|
|
266
266
|
orderUuid: (_g = this.store.currentOrder) == null ? void 0 : _g.uuid,
|
|
267
267
|
customerId: walletBusinessData.customer_id,
|
|
268
268
|
walletBusinessData: {
|
|
@@ -396,7 +396,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
396
396
|
this.store.currentOrder = paymentOrder;
|
|
397
397
|
if (params.autoPayment) {
|
|
398
398
|
}
|
|
399
|
-
this.core.effects.emit(
|
|
399
|
+
this.core.effects.emit(`${this.name}:onOrderCreated`, {
|
|
400
400
|
order: paymentOrder,
|
|
401
401
|
timestamp: Date.now()
|
|
402
402
|
});
|
|
@@ -417,7 +417,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
417
417
|
import_types.CheckoutErrorType.OrderCreationFailed
|
|
418
418
|
);
|
|
419
419
|
this.logError("本地订单创建失败:", error);
|
|
420
|
-
this.core.effects.emit(
|
|
420
|
+
this.core.effects.emit(`${this.name}:onOrderCreationFailed`, {
|
|
421
421
|
error: this.store.lastError,
|
|
422
422
|
timestamp: Date.now()
|
|
423
423
|
});
|
|
@@ -518,7 +518,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
518
518
|
totalAmount: updated.total_amount,
|
|
519
519
|
expectAmount: updated.expect_amount
|
|
520
520
|
});
|
|
521
|
-
await this.core.effects.emit(
|
|
521
|
+
await this.core.effects.emit(`${this.name}:onOrderCreated`, {
|
|
522
522
|
order: updated,
|
|
523
523
|
timestamp: Date.now()
|
|
524
524
|
});
|
|
@@ -584,7 +584,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
584
584
|
);
|
|
585
585
|
}
|
|
586
586
|
this.payment.wallet.clearAllCache();
|
|
587
|
-
await this.core.effects.emit(
|
|
587
|
+
await this.core.effects.emit(`${this.name}:onCheckoutCompleted`, {
|
|
588
588
|
orderId: order.id,
|
|
589
589
|
timestamp: Date.now()
|
|
590
590
|
});
|
|
@@ -695,7 +695,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
695
695
|
);
|
|
696
696
|
if (updatedOrder) {
|
|
697
697
|
this.store.currentOrder = updatedOrder;
|
|
698
|
-
await this.core.effects.emit(
|
|
698
|
+
await this.core.effects.emit(`${this.name}:onOrderCreated`, {
|
|
699
699
|
order: updatedOrder,
|
|
700
700
|
timestamp: Date.now()
|
|
701
701
|
});
|
|
@@ -736,7 +736,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
736
736
|
newAmount: formattedAmount
|
|
737
737
|
});
|
|
738
738
|
this.store.stateAmount = formattedAmount;
|
|
739
|
-
await this.core.effects.emit(
|
|
739
|
+
await this.core.effects.emit(`${this.name}:onStateAmountChanged`, {
|
|
740
740
|
oldAmount,
|
|
741
741
|
newAmount: formattedAmount,
|
|
742
742
|
timestamp: Date.now()
|
|
@@ -887,7 +887,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
|
-
this.core.effects.emit(
|
|
890
|
+
this.core.effects.emit(`${this.name}:onPaymentItemAdded`, {
|
|
891
891
|
orderUuid: this.store.currentOrder.uuid,
|
|
892
892
|
paymentMethodCode: paymentItem.code,
|
|
893
893
|
paymentMethodName: paymentItem.name,
|
|
@@ -963,7 +963,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
963
963
|
this.store.currentOrder = updatedOrder;
|
|
964
964
|
}
|
|
965
965
|
await this.updateStateAmountToRemaining(false);
|
|
966
|
-
await this.core.effects.emit(
|
|
966
|
+
await this.core.effects.emit(`${this.name}:onPaymentStarted`, {
|
|
967
967
|
orderUuid: this.store.currentOrder.uuid,
|
|
968
968
|
paymentMethodCode: paymentItem.code,
|
|
969
969
|
amount: `-${paymentItem.amount}`,
|
|
@@ -1057,7 +1057,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1057
1057
|
this.store.currentOrder = updatedOrder;
|
|
1058
1058
|
}
|
|
1059
1059
|
await this.updateStateAmountToRemaining(false);
|
|
1060
|
-
await this.core.effects.emit(
|
|
1060
|
+
await this.core.effects.emit(`${this.name}:onPaymentStarted`, {
|
|
1061
1061
|
orderUuid: this.store.currentOrder.uuid,
|
|
1062
1062
|
paymentMethodCode: "VOUCHER_BATCH",
|
|
1063
1063
|
amount: voucherPaymentItems.reduce((sum, item) => sum + parseFloat(String(item.amount)), 0).toFixed(2),
|
|
@@ -1118,7 +1118,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1118
1118
|
this.store.localOrderData.is_deposit = newDepositValue;
|
|
1119
1119
|
}
|
|
1120
1120
|
this.updateStateAmountToRemaining(false);
|
|
1121
|
-
await this.core.effects.emit(
|
|
1121
|
+
await this.core.effects.emit(`${this.name}:onOrderCreated`, {
|
|
1122
1122
|
order: this.store.currentOrder,
|
|
1123
1123
|
timestamp: Date.now()
|
|
1124
1124
|
});
|
|
@@ -1209,7 +1209,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1209
1209
|
}
|
|
1210
1210
|
}
|
|
1211
1211
|
this.updateStateAmountToRemaining(false);
|
|
1212
|
-
await this.core.effects.emit(
|
|
1212
|
+
await this.core.effects.emit(`${this.name}:onOrderCreated`, {
|
|
1213
1213
|
order: this.store.currentOrder,
|
|
1214
1214
|
timestamp: Date.now()
|
|
1215
1215
|
});
|
|
@@ -1393,7 +1393,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1393
1393
|
this.store.currentCustomer = void 0;
|
|
1394
1394
|
this.payment.wallet.clearAllCache();
|
|
1395
1395
|
this.logInfo("订单状态清理完成,currentOrder已释放");
|
|
1396
|
-
await this.core.effects.emit(
|
|
1396
|
+
await this.core.effects.emit(`${this.name}:onOrderCancelled`, {
|
|
1397
1397
|
orderUuid: currentOrderUuid,
|
|
1398
1398
|
orderId: currentOrderId,
|
|
1399
1399
|
cancelReason,
|
|
@@ -1510,7 +1510,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1510
1510
|
);
|
|
1511
1511
|
}
|
|
1512
1512
|
}
|
|
1513
|
-
await this.core.effects.emit(
|
|
1513
|
+
await this.core.effects.emit(`${this.name}:onOrderNoteChanged`, {
|
|
1514
1514
|
orderUuid: (_b = this.store.currentOrder) == null ? void 0 : _b.uuid,
|
|
1515
1515
|
oldNote,
|
|
1516
1516
|
newNote: note,
|
|
@@ -1535,7 +1535,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1535
1535
|
async handleError(error, type) {
|
|
1536
1536
|
const checkoutError = error instanceof Error && "type" in error ? error : (0, import_utils.createCheckoutError)(type, error.message, error);
|
|
1537
1537
|
this.store.lastError = checkoutError;
|
|
1538
|
-
await this.core.effects.emit(
|
|
1538
|
+
await this.core.effects.emit(`${this.name}:onError`, {
|
|
1539
1539
|
error: checkoutError,
|
|
1540
1540
|
context: {},
|
|
1541
1541
|
timestamp: Date.now()
|
|
@@ -1548,7 +1548,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1548
1548
|
async handlePaymentSuccess(data) {
|
|
1549
1549
|
var _a;
|
|
1550
1550
|
await this.updateStateAmountToRemaining();
|
|
1551
|
-
await this.core.effects.emit(
|
|
1551
|
+
await this.core.effects.emit(`${this.name}:onPaymentSuccess`, {
|
|
1552
1552
|
orderUuid: data.orderUuid,
|
|
1553
1553
|
paymentMethodCode: "",
|
|
1554
1554
|
amount: ((_a = this.store.currentOrder) == null ? void 0 : _a.total_amount) || "0",
|
|
@@ -1569,7 +1569,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1569
1569
|
error instanceof Error ? error : new Error(String(error)),
|
|
1570
1570
|
import_types.CheckoutErrorType.PaymentFailed
|
|
1571
1571
|
);
|
|
1572
|
-
await this.core.effects.emit(
|
|
1572
|
+
await this.core.effects.emit(`${this.name}:onPaymentFailed`, {
|
|
1573
1573
|
orderUuid: data.orderUuid,
|
|
1574
1574
|
paymentMethodCode: "",
|
|
1575
1575
|
amount: ((_a = this.store.currentOrder) == null ? void 0 : _a.total_amount) || "0",
|
|
@@ -1844,7 +1844,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1844
1844
|
const currentBalanceDueAmount = this.store.balanceDueAmount;
|
|
1845
1845
|
if (remainingAmount !== currentBalanceDueAmount) {
|
|
1846
1846
|
this.store.balanceDueAmount = remainingAmount;
|
|
1847
|
-
await this.core.effects.emit(
|
|
1847
|
+
await this.core.effects.emit(`${this.name}:onBalanceDueAmountChanged`, {
|
|
1848
1848
|
oldAmount: currentBalanceDueAmount,
|
|
1849
1849
|
newAmount: remainingAmount,
|
|
1850
1850
|
timestamp: Date.now(),
|
|
@@ -1899,7 +1899,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1899
1899
|
const currentStateAmount = this.store.stateAmount;
|
|
1900
1900
|
if (remainingAmount !== currentStateAmount) {
|
|
1901
1901
|
this.store.stateAmount = remainingAmount;
|
|
1902
|
-
this.core.effects.emit(
|
|
1902
|
+
this.core.effects.emit(`${this.name}:onStateAmountChanged`, {
|
|
1903
1903
|
oldAmount: currentStateAmount,
|
|
1904
1904
|
newAmount: remainingAmount,
|
|
1905
1905
|
timestamp: Date.now(),
|
|
@@ -1985,7 +1985,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1985
1985
|
this.logInfo("所有支付项均为代金券类型,跳过订单同步");
|
|
1986
1986
|
}
|
|
1987
1987
|
}
|
|
1988
|
-
await this.core.effects.emit(
|
|
1988
|
+
await this.core.effects.emit(`${this.name}:onOrderPaymentCompleted`, {
|
|
1989
1989
|
orderUuid: this.store.currentOrder.uuid,
|
|
1990
1990
|
orderId: this.store.currentOrder.order_id,
|
|
1991
1991
|
totalAmount,
|
|
@@ -2134,7 +2134,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2134
2134
|
}
|
|
2135
2135
|
}
|
|
2136
2136
|
const startTime = Date.now();
|
|
2137
|
-
await this.core.effects.emit(
|
|
2137
|
+
await this.core.effects.emit(`${this.name}:onOrderSubmitStart`, {
|
|
2138
2138
|
orderUuid: this.store.currentOrder.uuid,
|
|
2139
2139
|
operation: isUpdateOperation ? "update" : "create",
|
|
2140
2140
|
isManual,
|
|
@@ -2157,7 +2157,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2157
2157
|
submitSuccess = false;
|
|
2158
2158
|
submitError = error instanceof Error ? error.message : String(error);
|
|
2159
2159
|
this.logError("下单接口调用失败:", submitError);
|
|
2160
|
-
await this.core.effects.emit(
|
|
2160
|
+
await this.core.effects.emit(`${this.name}:onOrderSyncFailed`, {
|
|
2161
2161
|
orderUuid: this.store.currentOrder.uuid,
|
|
2162
2162
|
operation: isUpdateOperation ? "update" : "create",
|
|
2163
2163
|
isManual,
|
|
@@ -2168,7 +2168,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2168
2168
|
});
|
|
2169
2169
|
throw error;
|
|
2170
2170
|
} finally {
|
|
2171
|
-
await this.core.effects.emit(
|
|
2171
|
+
await this.core.effects.emit(`${this.name}:onOrderSubmitEnd`, {
|
|
2172
2172
|
success: submitSuccess,
|
|
2173
2173
|
orderUuid: this.store.currentOrder.uuid,
|
|
2174
2174
|
operation: isUpdateOperation ? "update" : "create",
|
|
@@ -2183,7 +2183,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2183
2183
|
const isSuccessResponse = responseStatus === true || responseStatus === 200 || responseStatus === "success" || responseStatus === 1 && (checkoutResponse == null ? void 0 : checkoutResponse.code) === 200;
|
|
2184
2184
|
if (!isSuccessResponse) {
|
|
2185
2185
|
const errorMessage = (checkoutResponse == null ? void 0 : checkoutResponse.message) || "订单同步失败,后端返回非成功状态";
|
|
2186
|
-
await this.core.effects.emit(
|
|
2186
|
+
await this.core.effects.emit(`${this.name}:onOrderSyncFailed`, {
|
|
2187
2187
|
orderUuid: this.store.currentOrder.uuid,
|
|
2188
2188
|
operation: isUpdateOperation ? "update" : "create",
|
|
2189
2189
|
isManual,
|
|
@@ -2267,7 +2267,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2267
2267
|
this.logWarning("标记支付项已同步失败(不阻塞主流程)", { error: e });
|
|
2268
2268
|
}
|
|
2269
2269
|
this.store.isOrderSynced = true;
|
|
2270
|
-
await this.core.effects.emit(
|
|
2270
|
+
await this.core.effects.emit(`${this.name}:onOrderSynced`, {
|
|
2271
2271
|
orderUuid: this.store.currentOrder.uuid,
|
|
2272
2272
|
realOrderId,
|
|
2273
2273
|
virtualOrderId: this.store.currentOrder.order_id,
|
|
@@ -2334,7 +2334,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2334
2334
|
if (this.store.localOrderData) {
|
|
2335
2335
|
this.store.localOrderData.shop_note = note;
|
|
2336
2336
|
}
|
|
2337
|
-
await this.core.effects.emit(
|
|
2337
|
+
await this.core.effects.emit(`${this.name}:onOrderNoteChanged`, {
|
|
2338
2338
|
orderUuid: this.store.currentOrder.uuid,
|
|
2339
2339
|
oldNote: previousNote,
|
|
2340
2340
|
newNote: note,
|
|
@@ -2502,7 +2502,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2502
2502
|
this.payment.wallet.clearAllCache();
|
|
2503
2503
|
console.log("[Checkout] Store 状态重置完成");
|
|
2504
2504
|
if (prevOrderInfo) {
|
|
2505
|
-
await this.core.effects.emit(
|
|
2505
|
+
await this.core.effects.emit(`${this.name}:onOrderCleared`, {
|
|
2506
2506
|
previousOrder: prevOrderInfo,
|
|
2507
2507
|
timestamp: Date.now()
|
|
2508
2508
|
});
|
|
@@ -76,7 +76,7 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
76
76
|
(_a = this.store.discount) == null ? void 0 : _a.destroy();
|
|
77
77
|
(_b = this.store.rules) == null ? void 0 : _b.destroy();
|
|
78
78
|
this.core.effects.offByModuleDestroy(this.name);
|
|
79
|
-
await this.core.effects.emit(
|
|
79
|
+
await this.core.effects.emit(`${this.name}:onDestroy`, {});
|
|
80
80
|
console.log("[ShopDiscount] 已销毁");
|
|
81
81
|
}
|
|
82
82
|
async clear() {
|