@pisell/pisellos 2.1.39 → 2.1.40
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 -0
- package/dist/effects/index.js +29 -6
- 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/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 +4 -1
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +2 -3
- package/dist/modules/Resource/index.js +1 -1
- package/dist/modules/Rules/index.js +2 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +2 -2
- package/dist/solution/BookingTicket/index.d.ts +5 -1
- package/dist/solution/BookingTicket/index.js +17 -8
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +25 -16
- package/dist/solution/BuyTickets/index.js +7 -8
- package/dist/solution/Checkout/index.js +35 -35
- package/dist/solution/RegisterAndLogin/config.js +2 -2
- package/dist/solution/RegisterAndLogin/index.js +2 -1
- package/dist/solution/ShopDiscount/index.js +36 -19
- package/dist/types/index.d.ts +1 -0
- package/lib/effects/index.d.ts +1 -0
- package/lib/effects/index.js +13 -0
- 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/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 +3 -1
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +2 -3
- package/lib/modules/Resource/index.js +1 -1
- package/lib/modules/Rules/index.js +2 -3
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1 -1
- package/lib/solution/BookingTicket/index.d.ts +5 -1
- package/lib/solution/BookingTicket/index.js +12 -6
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +7 -1
- package/lib/solution/BuyTickets/index.js +7 -8
- package/lib/solution/Checkout/index.js +34 -34
- package/lib/solution/RegisterAndLogin/config.js +2 -2
- package/lib/solution/RegisterAndLogin/index.js +2 -1
- package/lib/solution/ShopDiscount/index.js +19 -11
- package/lib/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
18
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
19
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
20
|
import { BaseModule } from "../../modules/BaseModule";
|
|
21
|
-
import {
|
|
21
|
+
import { createModule } from "./types";
|
|
22
22
|
import Scan from "./utils/scan";
|
|
23
23
|
import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./utils/scan/handleScan";
|
|
24
24
|
import scanCache from "./utils/scan/scanCache";
|
|
@@ -109,7 +109,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
109
109
|
throw new Error("\u6A21\u5757 ".concat(step, " \u4E0D\u5B58\u5728"));
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
this.core.effects.emit(
|
|
112
|
+
this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
113
113
|
case 19:
|
|
114
114
|
case "end":
|
|
115
115
|
return _context.stop();
|
|
@@ -152,7 +152,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
152
152
|
}));
|
|
153
153
|
case 5:
|
|
154
154
|
result = _context2.sent;
|
|
155
|
-
this.core.effects.emit(
|
|
155
|
+
this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
156
156
|
return _context2.abrupt("return", result);
|
|
157
157
|
case 10:
|
|
158
158
|
_context2.prev = 10;
|
|
@@ -170,11 +170,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
170
170
|
}
|
|
171
171
|
return loadProducts;
|
|
172
172
|
}()
|
|
173
|
+
/**
|
|
174
|
+
* 初始化外设扫码结果监听
|
|
175
|
+
*/
|
|
176
|
+
)
|
|
177
|
+
}, {
|
|
178
|
+
key: "initPeripheralsListener",
|
|
179
|
+
value: function initPeripheralsListener() {
|
|
180
|
+
this.scan.initPeripheralsListener();
|
|
181
|
+
}
|
|
182
|
+
|
|
173
183
|
/**
|
|
174
184
|
* 获取商品列表(不加载到模块中)
|
|
175
185
|
* @returns 商品列表
|
|
176
186
|
*/
|
|
177
|
-
)
|
|
178
187
|
}, {
|
|
179
188
|
key: "getProducts",
|
|
180
189
|
value: (function () {
|
|
@@ -242,7 +251,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
242
251
|
key: "setActiveCustomer",
|
|
243
252
|
value: function setActiveCustomer(customer) {
|
|
244
253
|
this.store.customer.setSelectedCustomer(customer);
|
|
245
|
-
this.core.effects.emit(
|
|
254
|
+
this.core.effects.emit("".concat(this.name, ":onCustomerSelected"), {
|
|
246
255
|
customer: customer
|
|
247
256
|
});
|
|
248
257
|
}
|
|
@@ -267,7 +276,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
267
276
|
var customer = this.store.customer.getCustomerById(customerId);
|
|
268
277
|
if (customer) {
|
|
269
278
|
this.store.customer.setSelectedCustomer(customer);
|
|
270
|
-
this.core.effects.emit(
|
|
279
|
+
this.core.effects.emit("".concat(this.name, ":onCustomerSelected"), {
|
|
271
280
|
customer: customer
|
|
272
281
|
});
|
|
273
282
|
}
|
|
@@ -398,7 +407,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
398
407
|
return this.store.customer.loadMoreCustomers();
|
|
399
408
|
case 3:
|
|
400
409
|
result = _context6.sent;
|
|
401
|
-
this.core.effects.emit(
|
|
410
|
+
this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), result);
|
|
402
411
|
return _context6.abrupt("return", result);
|
|
403
412
|
case 8:
|
|
404
413
|
_context6.prev = 8;
|
|
@@ -438,7 +447,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
438
447
|
return this.store.customer.resetAndLoadCustomers(params);
|
|
439
448
|
case 4:
|
|
440
449
|
result = _context7.sent;
|
|
441
|
-
this.core.effects.emit(
|
|
450
|
+
this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), result);
|
|
442
451
|
return _context7.abrupt("return", result);
|
|
443
452
|
case 9:
|
|
444
453
|
_context7.prev = 9;
|
|
@@ -18,9 +18,6 @@ var ScanResultType = /*#__PURE__*/function (ScanResultType) {
|
|
|
18
18
|
}(ScanResultType || {});
|
|
19
19
|
var Scan = /*#__PURE__*/function () {
|
|
20
20
|
function Scan(solution, watchKey) {
|
|
21
|
-
var _this$solution,
|
|
22
|
-
_this$solution$mountF,
|
|
23
|
-
_this = this;
|
|
24
21
|
_classCallCheck(this, Scan);
|
|
25
22
|
_defineProperty(this, "solution", void 0);
|
|
26
23
|
_defineProperty(this, "watchKey", void 0);
|
|
@@ -28,24 +25,36 @@ var Scan = /*#__PURE__*/function () {
|
|
|
28
25
|
this.solution = solution;
|
|
29
26
|
this.watchKey = watchKey;
|
|
30
27
|
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
var _result = JSON.parse(strVal);
|
|
35
|
-
console.log('nativeScannerResult>>>>>>>', _result);
|
|
36
|
-
_this.handleScan(_result);
|
|
37
|
-
} catch (err) {
|
|
38
|
-
console.error(err);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
28
|
+
// 初始化扫码监听
|
|
29
|
+
this.initPeripheralsListener();
|
|
41
30
|
}
|
|
42
31
|
|
|
43
32
|
/**
|
|
44
|
-
*
|
|
45
|
-
* @param eventKey 事件key
|
|
46
|
-
* @param value 扫码结果
|
|
33
|
+
* 初始化外设扫码结果监听
|
|
47
34
|
*/
|
|
48
35
|
_createClass(Scan, [{
|
|
36
|
+
key: "initPeripheralsListener",
|
|
37
|
+
value: function initPeripheralsListener() {
|
|
38
|
+
var _this$solution,
|
|
39
|
+
_this$solution$mountF,
|
|
40
|
+
_this = this;
|
|
41
|
+
(_this$solution = this.solution) === null || _this$solution === void 0 || (_this$solution = _this$solution.window) === null || _this$solution === void 0 || (_this$solution = _this$solution.interaction) === null || _this$solution === void 0 || (_this$solution = _this$solution.utils) === null || _this$solution === void 0 || (_this$solution$mountF = _this$solution.mountFunction) === null || _this$solution$mountF === void 0 || _this$solution$mountF.call(_this$solution, 'global', 'peripheralsResult', function (strVal) {
|
|
42
|
+
try {
|
|
43
|
+
var _result = JSON.parse(strVal);
|
|
44
|
+
console.log('nativeScannerResult>>>>>>>', _result);
|
|
45
|
+
_this.handleScan(_result);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
console.error(err);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 处理扫码事件
|
|
54
|
+
* @param eventKey 事件key
|
|
55
|
+
* @param value 扫码结果
|
|
56
|
+
*/
|
|
57
|
+
}, {
|
|
49
58
|
key: "handleScan",
|
|
50
59
|
value: function handleScan(result) {
|
|
51
60
|
var lastEnableEventKey = watch.getLastEnableEventKey(this.watchKey);
|
|
@@ -24,7 +24,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
25
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
26
|
import { ProductList } from "../../modules/";
|
|
27
|
-
import { BuyTicketsHooks } from "./types";
|
|
28
27
|
import { BaseModule } from "../../modules/BaseModule";
|
|
29
28
|
export * from "./types";
|
|
30
29
|
export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
@@ -72,7 +71,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
72
71
|
return this.loadProductsByIds(this.otherParams.prodctIds);
|
|
73
72
|
case 11:
|
|
74
73
|
_context.next = 13;
|
|
75
|
-
return this.core.effects.emit(
|
|
74
|
+
return this.core.effects.emit("".concat(this.name, ":onInited"), {});
|
|
76
75
|
case 13:
|
|
77
76
|
case "end":
|
|
78
77
|
return _context.stop();
|
|
@@ -112,7 +111,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
112
111
|
});
|
|
113
112
|
this.store.mainProducts = mainProducts;
|
|
114
113
|
_context2.next = 8;
|
|
115
|
-
return this.core.effects.emit(
|
|
114
|
+
return this.core.effects.emit("".concat(this.name, ":onMainProductsLoaded"), {});
|
|
116
115
|
case 8:
|
|
117
116
|
case "end":
|
|
118
117
|
return _context2.stop();
|
|
@@ -149,7 +148,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
149
148
|
while (1) switch (_context4.prev = _context4.next) {
|
|
150
149
|
case 0:
|
|
151
150
|
_context4.next = 2;
|
|
152
|
-
return this.core.effects.emit(
|
|
151
|
+
return this.core.effects.emit("".concat(this.name, ":onDestroy"), {});
|
|
153
152
|
case 2:
|
|
154
153
|
console.log('[BuyTickets] 已销毁');
|
|
155
154
|
case 3:
|
|
@@ -195,7 +194,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
195
194
|
case 11:
|
|
196
195
|
otherData = _context5.t1;
|
|
197
196
|
_context5.next = 14;
|
|
198
|
-
return this.core.effects.emit(
|
|
197
|
+
return this.core.effects.emit("".concat(this.name, ":onGetProducts"), [].concat(_toConsumableArray(mainData), _toConsumableArray(otherData)));
|
|
199
198
|
case 14:
|
|
200
199
|
return _context5.abrupt("return", [].concat(_toConsumableArray(mainData), _toConsumableArray(otherData)));
|
|
201
200
|
case 15:
|
|
@@ -259,7 +258,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
259
258
|
while (1) switch (_context7.prev = _context7.next) {
|
|
260
259
|
case 0:
|
|
261
260
|
_context7.next = 2;
|
|
262
|
-
return this.core.effects.emit(
|
|
261
|
+
return this.core.effects.emit("".concat(this.name, ":onListSubmit"), _objectSpread(_objectSpread({}, data), {}, {
|
|
263
262
|
products: this.getProducts()
|
|
264
263
|
}));
|
|
265
264
|
case 2:
|
|
@@ -298,7 +297,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
298
297
|
while (1) switch (_context8.prev = _context8.next) {
|
|
299
298
|
case 0:
|
|
300
299
|
_context8.next = 2;
|
|
301
|
-
return this.core.effects.emit(
|
|
300
|
+
return this.core.effects.emit("".concat(this.name, ":onCartSubmit"), _objectSpread(_objectSpread({}, data), {}, {
|
|
302
301
|
products: this.getProducts()
|
|
303
302
|
}));
|
|
304
303
|
case 2:
|
|
@@ -320,7 +319,7 @@ export var BuyTicketsImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
320
319
|
while (1) switch (_context9.prev = _context9.next) {
|
|
321
320
|
case 0:
|
|
322
321
|
_context9.next = 2;
|
|
323
|
-
return this.core.effects.emit(
|
|
322
|
+
return this.core.effects.emit("".concat(this.name, ":onCheckoutSubmit"), _objectSpread(_objectSpread({}, data), {}, {
|
|
324
323
|
products: this.getProducts()
|
|
325
324
|
}));
|
|
326
325
|
case 2:
|
|
@@ -32,7 +32,7 @@ import { BaseModule } from "../../modules/BaseModule";
|
|
|
32
32
|
import Decimal from 'decimal.js';
|
|
33
33
|
import { OrderModule } from "../../modules/Order";
|
|
34
34
|
import { PaymentModule } from "../../modules/Payment";
|
|
35
|
-
import {
|
|
35
|
+
import { CheckoutErrorType } from "./types";
|
|
36
36
|
import { PaymentStatus, PaymentHooks } from "../../modules/Payment/types";
|
|
37
37
|
import { validateCheckoutData, createCheckoutError, validateLocalOrderData, generateLocalOrderId, formatDateTime, extractAmountFromCartSummary, isVirtualOrderId, isCashPayment } from "./utils";
|
|
38
38
|
import { getProductDeposit } from "../../modules/Cart/utils";
|
|
@@ -123,7 +123,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
123
123
|
case 19:
|
|
124
124
|
console.log('[Checkout] 初始化完成');
|
|
125
125
|
_context.next = 22;
|
|
126
|
-
return this.core.effects.emit(
|
|
126
|
+
return this.core.effects.emit("".concat(this.name, ":onCheckoutInitialized"), {
|
|
127
127
|
timestamp: Date.now()
|
|
128
128
|
});
|
|
129
129
|
case 22:
|
|
@@ -459,7 +459,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
459
459
|
});
|
|
460
460
|
// 触发钱包数据初始化完成事件
|
|
461
461
|
_context8.next = 16;
|
|
462
|
-
return this.core.effects.emit(
|
|
462
|
+
return this.core.effects.emit("".concat(this.name, ":onWalletDataInitialized"), {
|
|
463
463
|
orderUuid: (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.uuid,
|
|
464
464
|
customerId: walletBusinessData.customer_id,
|
|
465
465
|
walletBusinessData: {
|
|
@@ -629,7 +629,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
629
629
|
// // 自动支付模式标记
|
|
630
630
|
// }
|
|
631
631
|
|
|
632
|
-
this.core.effects.emit(
|
|
632
|
+
this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
633
633
|
order: paymentOrder,
|
|
634
634
|
timestamp: Date.now()
|
|
635
635
|
});
|
|
@@ -665,7 +665,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
665
665
|
return this.handleError(_context9.t0, CheckoutErrorType.OrderCreationFailed);
|
|
666
666
|
case 38:
|
|
667
667
|
this.logError('本地订单创建失败:', _context9.t0);
|
|
668
|
-
this.core.effects.emit(
|
|
668
|
+
this.core.effects.emit("".concat(this.name, ":onOrderCreationFailed"), {
|
|
669
669
|
error: this.store.lastError,
|
|
670
670
|
timestamp: Date.now()
|
|
671
671
|
});
|
|
@@ -803,7 +803,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
803
803
|
|
|
804
804
|
// 事件通知(复用创建事件,便于上层监听刷新)
|
|
805
805
|
_context10.next = 38;
|
|
806
|
-
return this.core.effects.emit(
|
|
806
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
807
807
|
order: updated,
|
|
808
808
|
timestamp: Date.now()
|
|
809
809
|
});
|
|
@@ -891,7 +891,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
891
891
|
// 清理钱包模块的所有缓存数据
|
|
892
892
|
this.payment.wallet.clearAllCache();
|
|
893
893
|
_context11.next = 11;
|
|
894
|
-
return this.core.effects.emit(
|
|
894
|
+
return this.core.effects.emit("".concat(this.name, ":onCheckoutCompleted"), {
|
|
895
895
|
orderId: order.id,
|
|
896
896
|
timestamp: Date.now()
|
|
897
897
|
});
|
|
@@ -1078,7 +1078,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1078
1078
|
|
|
1079
1079
|
// 触发订单更新事件
|
|
1080
1080
|
_context13.next = 11;
|
|
1081
|
-
return this.core.effects.emit(
|
|
1081
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
1082
1082
|
order: updatedOrder,
|
|
1083
1083
|
timestamp: Date.now()
|
|
1084
1084
|
});
|
|
@@ -1158,7 +1158,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1158
1158
|
|
|
1159
1159
|
// 触发金额变更事件
|
|
1160
1160
|
_context14.next = 12;
|
|
1161
|
-
return this.core.effects.emit(
|
|
1161
|
+
return this.core.effects.emit("".concat(this.name, ":onStateAmountChanged"), {
|
|
1162
1162
|
oldAmount: oldAmount,
|
|
1163
1163
|
newAmount: formattedAmount,
|
|
1164
1164
|
timestamp: Date.now()
|
|
@@ -1385,7 +1385,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1385
1385
|
return this.handleError(new Error("EFTPOS \u652F\u4ED8\u540E\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(_context16.t0 instanceof Error ? _context16.t0.message : String(_context16.t0))), CheckoutErrorType.OrderCreationFailed);
|
|
1386
1386
|
case 39:
|
|
1387
1387
|
// 触发支付项添加事件(可以复用支付开始事件)
|
|
1388
|
-
this.core.effects.emit(
|
|
1388
|
+
this.core.effects.emit("".concat(this.name, ":onPaymentItemAdded"), {
|
|
1389
1389
|
orderUuid: this.store.currentOrder.uuid,
|
|
1390
1390
|
paymentMethodCode: paymentItem.code,
|
|
1391
1391
|
paymentMethodName: paymentItem.name,
|
|
@@ -1498,7 +1498,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1498
1498
|
return this.updateStateAmountToRemaining(false);
|
|
1499
1499
|
case 23:
|
|
1500
1500
|
_context17.next = 25;
|
|
1501
|
-
return this.core.effects.emit(
|
|
1501
|
+
return this.core.effects.emit("".concat(this.name, ":onPaymentStarted"), {
|
|
1502
1502
|
orderUuid: this.store.currentOrder.uuid,
|
|
1503
1503
|
paymentMethodCode: paymentItem.code,
|
|
1504
1504
|
amount: "-".concat(paymentItem.amount),
|
|
@@ -1632,7 +1632,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1632
1632
|
return this.updateStateAmountToRemaining(false);
|
|
1633
1633
|
case 29:
|
|
1634
1634
|
_context18.next = 31;
|
|
1635
|
-
return this.core.effects.emit(
|
|
1635
|
+
return this.core.effects.emit("".concat(this.name, ":onPaymentStarted"), {
|
|
1636
1636
|
orderUuid: this.store.currentOrder.uuid,
|
|
1637
1637
|
paymentMethodCode: 'VOUCHER_BATCH',
|
|
1638
1638
|
amount: voucherPaymentItems.reduce(function (sum, item) {
|
|
@@ -1737,7 +1737,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1737
1737
|
|
|
1738
1738
|
// 触发订单更新事件
|
|
1739
1739
|
_context19.next = 21;
|
|
1740
|
-
return this.core.effects.emit(
|
|
1740
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
1741
1741
|
order: this.store.currentOrder,
|
|
1742
1742
|
timestamp: Date.now()
|
|
1743
1743
|
});
|
|
@@ -1866,7 +1866,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1866
1866
|
|
|
1867
1867
|
// 触发订单更新事件
|
|
1868
1868
|
_context20.next = 23;
|
|
1869
|
-
return this.core.effects.emit(
|
|
1869
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
1870
1870
|
order: this.store.currentOrder,
|
|
1871
1871
|
timestamp: Date.now()
|
|
1872
1872
|
});
|
|
@@ -2140,7 +2140,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2140
2140
|
|
|
2141
2141
|
// 触发订单取消事件
|
|
2142
2142
|
_context22.next = 32;
|
|
2143
|
-
return this.core.effects.emit(
|
|
2143
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderCancelled"), {
|
|
2144
2144
|
orderUuid: currentOrderUuid,
|
|
2145
2145
|
orderId: currentOrderId,
|
|
2146
2146
|
cancelReason: cancelReason,
|
|
@@ -2311,7 +2311,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2311
2311
|
console.warn('[Checkout] 同步备注到Payment模块失败,但本地更新成功:', _context24.t0);
|
|
2312
2312
|
case 17:
|
|
2313
2313
|
_context24.next = 19;
|
|
2314
|
-
return this.core.effects.emit(
|
|
2314
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderNoteChanged"), {
|
|
2315
2315
|
orderUuid: (_this$store$currentOr20 = this.store.currentOrder) === null || _this$store$currentOr20 === void 0 ? void 0 : _this$store$currentOr20.uuid,
|
|
2316
2316
|
oldNote: oldNote,
|
|
2317
2317
|
newNote: note,
|
|
@@ -2358,7 +2358,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2358
2358
|
checkoutError = error instanceof Error && 'type' in error ? error : createCheckoutError(type, error.message, error);
|
|
2359
2359
|
this.store.lastError = checkoutError;
|
|
2360
2360
|
_context25.next = 4;
|
|
2361
|
-
return this.core.effects.emit(
|
|
2361
|
+
return this.core.effects.emit("".concat(this.name, ":onError"), {
|
|
2362
2362
|
error: checkoutError,
|
|
2363
2363
|
context: {},
|
|
2364
2364
|
timestamp: Date.now()
|
|
@@ -2392,7 +2392,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2392
2392
|
return this.updateStateAmountToRemaining();
|
|
2393
2393
|
case 2:
|
|
2394
2394
|
_context26.next = 4;
|
|
2395
|
-
return this.core.effects.emit(
|
|
2395
|
+
return this.core.effects.emit("".concat(this.name, ":onPaymentSuccess"), {
|
|
2396
2396
|
orderUuid: data.orderUuid,
|
|
2397
2397
|
paymentMethodCode: '',
|
|
2398
2398
|
amount: ((_this$store$currentOr21 = this.store.currentOrder) === null || _this$store$currentOr21 === void 0 ? void 0 : _this$store$currentOr21.total_amount) || '0',
|
|
@@ -2430,7 +2430,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2430
2430
|
return this.handleError(error instanceof Error ? error : new Error(String(error)), CheckoutErrorType.PaymentFailed);
|
|
2431
2431
|
case 3:
|
|
2432
2432
|
_context27.next = 5;
|
|
2433
|
-
return this.core.effects.emit(
|
|
2433
|
+
return this.core.effects.emit("".concat(this.name, ":onPaymentFailed"), {
|
|
2434
2434
|
orderUuid: data.orderUuid,
|
|
2435
2435
|
paymentMethodCode: '',
|
|
2436
2436
|
amount: ((_this$store$currentOr22 = this.store.currentOrder) === null || _this$store$currentOr22 === void 0 ? void 0 : _this$store$currentOr22.total_amount) || '0',
|
|
@@ -2873,7 +2873,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2873
2873
|
|
|
2874
2874
|
/**
|
|
2875
2875
|
* 计算已支付金额(从 Payment 模块获取最新数据)
|
|
2876
|
-
*
|
|
2876
|
+
*
|
|
2877
2877
|
* 注意:此方法保持独立性,可以单独调用。
|
|
2878
2878
|
* 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
|
|
2879
2879
|
*/
|
|
@@ -2965,7 +2965,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2965
2965
|
|
|
2966
2966
|
/**
|
|
2967
2967
|
* 计算剩余未支付金额(从 Payment 模块获取最新数据)
|
|
2968
|
-
*
|
|
2968
|
+
*
|
|
2969
2969
|
* 注意:此方法保持独立性,可以单独调用。
|
|
2970
2970
|
* 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
|
|
2971
2971
|
*/
|
|
@@ -3015,7 +3015,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3015
3015
|
}()
|
|
3016
3016
|
/**
|
|
3017
3017
|
* 计算剩余未支付金额(排除定金计算,始终使用订单总金额)
|
|
3018
|
-
*
|
|
3018
|
+
*
|
|
3019
3019
|
* 注意:此方法保持独立性,可以单独调用。
|
|
3020
3020
|
* 在 updateStateAmountToRemaining 等批量操作中会使用缓存优化。
|
|
3021
3021
|
*/
|
|
@@ -3094,7 +3094,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3094
3094
|
|
|
3095
3095
|
// 发出 balanceDueAmount 变更事件
|
|
3096
3096
|
_context35.next = 12;
|
|
3097
|
-
return this.core.effects.emit(
|
|
3097
|
+
return this.core.effects.emit("".concat(this.name, ":onBalanceDueAmountChanged"), {
|
|
3098
3098
|
oldAmount: currentBalanceDueAmount,
|
|
3099
3099
|
newAmount: remainingAmount,
|
|
3100
3100
|
timestamp: Date.now(),
|
|
@@ -3132,7 +3132,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3132
3132
|
}()
|
|
3133
3133
|
/**
|
|
3134
3134
|
* 更新 stateAmount 为当前剩余未支付金额
|
|
3135
|
-
*
|
|
3135
|
+
*
|
|
3136
3136
|
* 优化版本:批量获取数据,避免重复查询数据库
|
|
3137
3137
|
*/
|
|
3138
3138
|
)
|
|
@@ -3306,7 +3306,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3306
3306
|
}()
|
|
3307
3307
|
/**
|
|
3308
3308
|
* 检查订单支付是否完成(优化版,复用已获取的数据)
|
|
3309
|
-
*
|
|
3309
|
+
*
|
|
3310
3310
|
* @param paymentItems 已获取的支付项数据
|
|
3311
3311
|
* @param remainingAmount 已计算的剩余金额
|
|
3312
3312
|
*/
|
|
@@ -3415,7 +3415,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3415
3415
|
* 检查订单支付是否完成
|
|
3416
3416
|
*
|
|
3417
3417
|
* 当剩余待付款金额 <= 0 时,触发订单支付完成事件
|
|
3418
|
-
*
|
|
3418
|
+
*
|
|
3419
3419
|
* 注意:此方法保持独立性,可以单独调用。
|
|
3420
3420
|
* 在 updateStateAmountToRemaining 中会使用优化版本。
|
|
3421
3421
|
*/
|
|
@@ -3514,7 +3514,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3514
3514
|
}
|
|
3515
3515
|
case 27:
|
|
3516
3516
|
_context38.next = 29;
|
|
3517
|
-
return this.core.effects.emit(
|
|
3517
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderPaymentCompleted"), {
|
|
3518
3518
|
orderUuid: this.store.currentOrder.uuid,
|
|
3519
3519
|
orderId: this.store.currentOrder.order_id,
|
|
3520
3520
|
totalAmount: totalAmount,
|
|
@@ -3752,7 +3752,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3752
3752
|
// 发送下单接口请求开始事件
|
|
3753
3753
|
startTime = Date.now();
|
|
3754
3754
|
_context39.next = 27;
|
|
3755
|
-
return this.core.effects.emit(
|
|
3755
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderSubmitStart"), {
|
|
3756
3756
|
orderUuid: this.store.currentOrder.uuid,
|
|
3757
3757
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
3758
3758
|
isManual: isManual,
|
|
@@ -3786,7 +3786,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3786
3786
|
|
|
3787
3787
|
// 发送订单同步失败事件(网络错误或请求失败)
|
|
3788
3788
|
_context39.next = 44;
|
|
3789
|
-
return this.core.effects.emit(
|
|
3789
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderSyncFailed"), {
|
|
3790
3790
|
orderUuid: this.store.currentOrder.uuid,
|
|
3791
3791
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
3792
3792
|
isManual: isManual,
|
|
@@ -3800,7 +3800,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3800
3800
|
case 45:
|
|
3801
3801
|
_context39.prev = 45;
|
|
3802
3802
|
_context39.next = 48;
|
|
3803
|
-
return this.core.effects.emit(
|
|
3803
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderSubmitEnd"), {
|
|
3804
3804
|
success: submitSuccess,
|
|
3805
3805
|
orderUuid: this.store.currentOrder.uuid,
|
|
3806
3806
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
@@ -3822,7 +3822,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3822
3822
|
}
|
|
3823
3823
|
errorMessage = ((_checkoutResponse5 = checkoutResponse) === null || _checkoutResponse5 === void 0 ? void 0 : _checkoutResponse5.message) || '订单同步失败,后端返回非成功状态'; // 发送订单同步失败事件
|
|
3824
3824
|
_context39.next = 55;
|
|
3825
|
-
return this.core.effects.emit(
|
|
3825
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderSyncFailed"), {
|
|
3826
3826
|
orderUuid: this.store.currentOrder.uuid,
|
|
3827
3827
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
3828
3828
|
isManual: isManual,
|
|
@@ -3958,7 +3958,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3958
3958
|
|
|
3959
3959
|
// 触发订单同步完成事件
|
|
3960
3960
|
_context39.next = 107;
|
|
3961
|
-
return this.core.effects.emit(
|
|
3961
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderSynced"), {
|
|
3962
3962
|
orderUuid: this.store.currentOrder.uuid,
|
|
3963
3963
|
realOrderId: realOrderId,
|
|
3964
3964
|
virtualOrderId: this.store.currentOrder.order_id,
|
|
@@ -4085,7 +4085,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4085
4085
|
|
|
4086
4086
|
// 触发订单备注变更事件
|
|
4087
4087
|
_context41.next = 15;
|
|
4088
|
-
return this.core.effects.emit(
|
|
4088
|
+
return this.core.effects.emit("".concat(this.name, ":onOrderNoteChanged"), {
|
|
4089
4089
|
orderUuid: this.store.currentOrder.uuid,
|
|
4090
4090
|
oldNote: previousNote,
|
|
4091
4091
|
newNote: note,
|
|
@@ -4335,7 +4335,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4335
4335
|
* 重置 store 状态
|
|
4336
4336
|
*
|
|
4337
4337
|
* 在创建新订单前调用,确保状态完全干净
|
|
4338
|
-
*
|
|
4338
|
+
*
|
|
4339
4339
|
* 🚀 性能优化:改为同步方法,事件发射不阻塞主流程
|
|
4340
4340
|
*/
|
|
4341
4341
|
}, {
|
|
@@ -4376,7 +4376,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4376
4376
|
// 使用 setTimeout 确保事件处理不会阻塞状态重置
|
|
4377
4377
|
if (prevOrderInfo) {
|
|
4378
4378
|
setTimeout(function () {
|
|
4379
|
-
_this6.core.effects.emit(
|
|
4379
|
+
_this6.core.effects.emit("".concat(_this6.name, ":onOrderCleared"), {
|
|
4380
4380
|
previousOrder: prevOrderInfo,
|
|
4381
4381
|
timestamp: Date.now()
|
|
4382
4382
|
});
|
|
@@ -344,7 +344,7 @@ var onlineStoreConfig = {
|
|
|
344
344
|
method: 'POST',
|
|
345
345
|
transformParams: function transformParams(params) {
|
|
346
346
|
return {
|
|
347
|
-
|
|
347
|
+
code: params.code
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -666,7 +666,7 @@ var defaultConfig = {
|
|
|
666
666
|
method: 'POST',
|
|
667
667
|
transformParams: function transformParams(params) {
|
|
668
668
|
return {
|
|
669
|
-
|
|
669
|
+
code: params.code
|
|
670
670
|
};
|
|
671
671
|
}
|
|
672
672
|
}
|
|
@@ -2416,7 +2416,8 @@ export var RegisterAndLoginImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2416
2416
|
console.log('[RegisterAndLogin] 调用后端 appleLogin 接口');
|
|
2417
2417
|
_context36.next = 9;
|
|
2418
2418
|
return _this3.apiCaller.call('appleLogin', {
|
|
2419
|
-
|
|
2419
|
+
code: identityToken || authorizationCode,
|
|
2420
|
+
login_channel: _this3.channel
|
|
2420
2421
|
});
|
|
2421
2422
|
case 9:
|
|
2422
2423
|
result = _context36.sent;
|