@pisell/pisellos 0.0.236 → 0.0.237
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/Order/index.d.ts +1 -1
- package/dist/modules/Payment/types.d.ts +46 -1
- package/dist/modules/Payment/types.js +15 -0
- package/dist/modules/Payment/walletpass.js +36 -11
- package/dist/solution/BookingTicket/index.d.ts +1 -1
- package/dist/solution/Checkout/index.js +49 -40
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Payment/types.d.ts +46 -1
- package/lib/modules/Payment/types.js +3 -0
- package/lib/modules/Payment/walletpass.js +27 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -1
- package/lib/solution/Checkout/index.js +11 -5
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
10
10
|
constructor(name?: string, version?: string);
|
|
11
11
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
12
12
|
createOrder(params: CommitOrderParams['query']): {
|
|
13
|
-
type: "
|
|
13
|
+
type: "virtual" | "appointment_booking";
|
|
14
14
|
platform: string;
|
|
15
15
|
sales_channel: string;
|
|
16
16
|
order_sales_channel: string;
|
|
@@ -476,6 +476,48 @@ export interface OnSearchIdentificationCodeCompletedEventData {
|
|
|
476
476
|
/** 搜索参数 */
|
|
477
477
|
searchParams: SearchIdentificationCodeParams;
|
|
478
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* 钱包初始化开始事件数据
|
|
481
|
+
*/
|
|
482
|
+
export interface OnWalletInitializationStartedEventData {
|
|
483
|
+
/** 业务数据 */
|
|
484
|
+
businessData: WalletInitBusinessData;
|
|
485
|
+
/** 开始时间 */
|
|
486
|
+
startTime: number;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* 钱包初始化完成事件数据
|
|
490
|
+
*/
|
|
491
|
+
export interface OnWalletInitializationCompletedEventData {
|
|
492
|
+
/** 业务数据 */
|
|
493
|
+
businessData: WalletInitBusinessData;
|
|
494
|
+
/** 初始化结果 */
|
|
495
|
+
result: {
|
|
496
|
+
walletRecommendList: WalletRecommendItem[];
|
|
497
|
+
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
498
|
+
};
|
|
499
|
+
/** 开始时间 */
|
|
500
|
+
startTime: number;
|
|
501
|
+
/** 结束时间 */
|
|
502
|
+
endTime: number;
|
|
503
|
+
/** 执行时长(毫秒) */
|
|
504
|
+
duration: number;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* 钱包初始化失败事件数据
|
|
508
|
+
*/
|
|
509
|
+
export interface OnWalletInitializationFailedEventData {
|
|
510
|
+
/** 业务数据 */
|
|
511
|
+
businessData: WalletInitBusinessData;
|
|
512
|
+
/** 错误信息 */
|
|
513
|
+
error: Error;
|
|
514
|
+
/** 开始时间 */
|
|
515
|
+
startTime: number;
|
|
516
|
+
/** 结束时间 */
|
|
517
|
+
endTime: number;
|
|
518
|
+
/** 执行时长(毫秒) */
|
|
519
|
+
duration: number;
|
|
520
|
+
}
|
|
479
521
|
/**
|
|
480
522
|
* 钱包支付事件枚举
|
|
481
523
|
*/
|
|
@@ -485,7 +527,10 @@ export declare enum WalletPassHooks {
|
|
|
485
527
|
OnUserIdentificationCodesUpdated = "wallet:onUserIdentificationCodesUpdated",
|
|
486
528
|
OnUserIdentificationCodesCleared = "wallet:onUserIdentificationCodesCleared",
|
|
487
529
|
OnWalletCacheCleared = "wallet:onWalletCacheCleared",
|
|
488
|
-
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted"
|
|
530
|
+
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted",
|
|
531
|
+
OnWalletInitializationStarted = "wallet:onWalletInitializationStarted",
|
|
532
|
+
OnWalletInitializationCompleted = "wallet:onWalletInitializationCompleted",
|
|
533
|
+
OnWalletInitializationFailed = "wallet:onWalletInitializationFailed"
|
|
489
534
|
}
|
|
490
535
|
/**
|
|
491
536
|
* 支付钩子事件(统一接口)
|
|
@@ -156,6 +156,18 @@ export var RoundingInterval = /*#__PURE__*/function (RoundingInterval) {
|
|
|
156
156
|
* 搜索识别码完成事件数据
|
|
157
157
|
*/
|
|
158
158
|
|
|
159
|
+
/**
|
|
160
|
+
* 钱包初始化开始事件数据
|
|
161
|
+
*/
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 钱包初始化完成事件数据
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 钱包初始化失败事件数据
|
|
169
|
+
*/
|
|
170
|
+
|
|
159
171
|
/**
|
|
160
172
|
* 钱包支付事件枚举
|
|
161
173
|
*/
|
|
@@ -166,6 +178,9 @@ export var WalletPassHooks = /*#__PURE__*/function (WalletPassHooks) {
|
|
|
166
178
|
WalletPassHooks["OnUserIdentificationCodesCleared"] = "wallet:onUserIdentificationCodesCleared";
|
|
167
179
|
WalletPassHooks["OnWalletCacheCleared"] = "wallet:onWalletCacheCleared";
|
|
168
180
|
WalletPassHooks["OnSearchIdentificationCodeCompleted"] = "wallet:onSearchIdentificationCodeCompleted";
|
|
181
|
+
WalletPassHooks["OnWalletInitializationStarted"] = "wallet:onWalletInitializationStarted";
|
|
182
|
+
WalletPassHooks["OnWalletInitializationCompleted"] = "wallet:onWalletInitializationCompleted";
|
|
183
|
+
WalletPassHooks["OnWalletInitializationFailed"] = "wallet:onWalletInitializationFailed";
|
|
169
184
|
return WalletPassHooks;
|
|
170
185
|
}({});
|
|
171
186
|
|
|
@@ -110,27 +110,52 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
|
|
|
110
110
|
key: "initializeWalletDataFromBusinessAsync",
|
|
111
111
|
value: (function () {
|
|
112
112
|
var _initializeWalletDataFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(businessData) {
|
|
113
|
-
var walletParams;
|
|
113
|
+
var startTime, walletParams, result, endTime, duration, _endTime, _duration;
|
|
114
114
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
115
115
|
while (1) switch (_context.prev = _context.next) {
|
|
116
116
|
case 0:
|
|
117
|
-
|
|
117
|
+
startTime = Date.now(); // 发送初始化开始事件
|
|
118
|
+
this.emitEvent(WalletPassHooks.OnWalletInitializationStarted, {
|
|
119
|
+
businessData: businessData,
|
|
120
|
+
startTime: startTime
|
|
121
|
+
});
|
|
122
|
+
_context.prev = 2;
|
|
118
123
|
// 生成钱包API参数
|
|
119
124
|
walletParams = this.generateWalletParams(businessData); // 调用标准的初始化流程
|
|
120
|
-
_context.next =
|
|
125
|
+
_context.next = 6;
|
|
121
126
|
return this.initializeWalletDataAsync(walletParams);
|
|
122
|
-
case
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
case 6:
|
|
128
|
+
result = _context.sent;
|
|
129
|
+
endTime = Date.now();
|
|
130
|
+
duration = endTime - startTime; // 发送初始化完成事件
|
|
131
|
+
this.emitEvent(WalletPassHooks.OnWalletInitializationCompleted, {
|
|
132
|
+
businessData: businessData,
|
|
133
|
+
result: result,
|
|
134
|
+
startTime: startTime,
|
|
135
|
+
endTime: endTime,
|
|
136
|
+
duration: duration
|
|
137
|
+
});
|
|
138
|
+
console.log("[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u6210\u529F\uFF0C\u8017\u65F6: ".concat(duration, "ms"));
|
|
139
|
+
return _context.abrupt("return", result);
|
|
140
|
+
case 14:
|
|
141
|
+
_context.prev = 14;
|
|
142
|
+
_context.t0 = _context["catch"](2);
|
|
143
|
+
_endTime = Date.now();
|
|
144
|
+
_duration = _endTime - startTime; // 发送初始化失败事件
|
|
145
|
+
this.emitEvent(WalletPassHooks.OnWalletInitializationFailed, {
|
|
146
|
+
businessData: businessData,
|
|
147
|
+
error: _context.t0,
|
|
148
|
+
startTime: startTime,
|
|
149
|
+
endTime: _endTime,
|
|
150
|
+
duration: _duration
|
|
151
|
+
});
|
|
152
|
+
console.error("[WalletPass] \u4ECE\u4E1A\u52A1\u6570\u636E\u521D\u59CB\u5316\u94B1\u5305\u6570\u636E\u5931\u8D25\uFF0C\u8017\u65F6: ".concat(_duration, "ms"), _context.t0);
|
|
128
153
|
throw _context.t0;
|
|
129
|
-
case
|
|
154
|
+
case 21:
|
|
130
155
|
case "end":
|
|
131
156
|
return _context.stop();
|
|
132
157
|
}
|
|
133
|
-
}, _callee, this, [[
|
|
158
|
+
}, _callee, this, [[2, 14]]);
|
|
134
159
|
}));
|
|
135
160
|
function initializeWalletDataFromBusinessAsync(_x) {
|
|
136
161
|
return _initializeWalletDataFromBusinessAsync.apply(this, arguments);
|
|
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
111
111
|
* 获取当前的客户搜索条件
|
|
112
112
|
* @returns 当前搜索条件
|
|
113
113
|
*/
|
|
114
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
5
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
6
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
7
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
@@ -313,7 +313,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
313
313
|
}, {
|
|
314
314
|
key: "getProductListByOrder",
|
|
315
315
|
value: function getProductListByOrder() {
|
|
316
|
-
var _this$store$currentOr;
|
|
316
|
+
var _this$store$currentOr, _this$store$currentOr2;
|
|
317
317
|
if (!this.store.currentOrder) {
|
|
318
318
|
return [];
|
|
319
319
|
}
|
|
@@ -322,26 +322,34 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
322
322
|
return pre + (item.amount || 0);
|
|
323
323
|
}, 0);
|
|
324
324
|
};
|
|
325
|
-
var productList = (_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.
|
|
325
|
+
var productList = ((_this$store$currentOr = this.store.currentOrder.order_info) === null || _this$store$currentOr === void 0 || (_this$store$currentOr = _this$store$currentOr.original_order_data.bookings) === null || _this$store$currentOr === void 0 ? void 0 : _this$store$currentOr.map(function (item) {
|
|
326
326
|
return {
|
|
327
327
|
product_id: item.product.product_id,
|
|
328
328
|
product_variant_id: item.product.product_variant_id,
|
|
329
329
|
quantity: item.product.num,
|
|
330
330
|
selling_price: item.product.price - (item.product.discount_amount || 0) - getDiscountListAmount(item.product.discount_list)
|
|
331
331
|
};
|
|
332
|
-
});
|
|
333
|
-
|
|
332
|
+
})) || [];
|
|
333
|
+
var relationProducts = ((_this$store$currentOr2 = this.store.currentOrder.order_info) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.original_order_data) === null || _this$store$currentOr2 === void 0 || (_this$store$currentOr2 = _this$store$currentOr2.relation_products) === null || _this$store$currentOr2 === void 0 ? void 0 : _this$store$currentOr2.map(function (item) {
|
|
334
|
+
return {
|
|
335
|
+
product_id: item.product_id,
|
|
336
|
+
product_variant_id: item.product_variant_id,
|
|
337
|
+
quantity: item.num,
|
|
338
|
+
selling_price: item.source_product_price
|
|
339
|
+
};
|
|
340
|
+
})) || [];
|
|
341
|
+
return [].concat(_toConsumableArray(productList), _toConsumableArray(relationProducts));
|
|
334
342
|
}
|
|
335
343
|
}, {
|
|
336
344
|
key: "initWalletData",
|
|
337
345
|
value: function () {
|
|
338
346
|
var _initWalletData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params) {
|
|
339
|
-
var _this$store$
|
|
347
|
+
var _this$store$currentOr3, _this$store$currentCu;
|
|
340
348
|
var amountInfo, walletBusinessData;
|
|
341
349
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
342
350
|
while (1) switch (_context8.prev = _context8.next) {
|
|
343
351
|
case 0:
|
|
344
|
-
amountInfo = (_this$store$
|
|
352
|
+
amountInfo = (_this$store$currentOr3 = this.store.currentOrder) === null || _this$store$currentOr3 === void 0 || (_this$store$currentOr3 = _this$store$currentOr3.order_info) === null || _this$store$currentOr3 === void 0 ? void 0 : _this$store$currentOr3.amount_breakdown;
|
|
345
353
|
if (amountInfo) {
|
|
346
354
|
_context8.next = 3;
|
|
347
355
|
break;
|
|
@@ -978,12 +986,12 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
978
986
|
key: "getCheckoutSummaryAsync",
|
|
979
987
|
value: (function () {
|
|
980
988
|
var _getCheckoutSummaryAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
981
|
-
var _this$store$
|
|
989
|
+
var _this$store$currentOr4, _this$store$currentOr5;
|
|
982
990
|
var totalAmount, paidAmount, remainingAmount;
|
|
983
991
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
984
992
|
while (1) switch (_context15.prev = _context15.next) {
|
|
985
993
|
case 0:
|
|
986
|
-
totalAmount = ((_this$store$
|
|
994
|
+
totalAmount = ((_this$store$currentOr4 = this.store.currentOrder) === null || _this$store$currentOr4 === void 0 ? void 0 : _this$store$currentOr4.total_amount) || '0.00';
|
|
987
995
|
_context15.next = 3;
|
|
988
996
|
return this.calculatePaidAmountAsync();
|
|
989
997
|
case 3:
|
|
@@ -997,7 +1005,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
997
1005
|
totalAmount: totalAmount,
|
|
998
1006
|
paidAmount: paidAmount,
|
|
999
1007
|
remainingAmount: remainingAmount,
|
|
1000
|
-
paymentStatus: ((_this$store$
|
|
1008
|
+
paymentStatus: ((_this$store$currentOr5 = this.store.currentOrder) === null || _this$store$currentOr5 === void 0 ? void 0 : _this$store$currentOr5.payment_status) || PaymentStatus.Processing,
|
|
1001
1009
|
availablePaymentMethods: this.store.paymentMethods
|
|
1002
1010
|
});
|
|
1003
1011
|
case 8:
|
|
@@ -1084,8 +1092,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1084
1092
|
}, {
|
|
1085
1093
|
key: "getOrderOriginalData",
|
|
1086
1094
|
value: function getOrderOriginalData() {
|
|
1087
|
-
var _this$store$
|
|
1088
|
-
return (_this$store$
|
|
1095
|
+
var _this$store$currentOr6;
|
|
1096
|
+
return (_this$store$currentOr6 = this.store.currentOrder) === null || _this$store$currentOr6 === void 0 ? void 0 : _this$store$currentOr6.order_info;
|
|
1089
1097
|
}
|
|
1090
1098
|
|
|
1091
1099
|
/**
|
|
@@ -2258,7 +2266,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2258
2266
|
key: "manualSyncOrderAsync",
|
|
2259
2267
|
value: (function () {
|
|
2260
2268
|
var _manualSyncOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2261
|
-
var orderUuid, oldOrderId, realOrderId, finalOrderId, finalIsVirtual, _this$store$
|
|
2269
|
+
var orderUuid, oldOrderId, realOrderId, finalOrderId, finalIsVirtual, _this$store$currentOr7, errorMessage;
|
|
2262
2270
|
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
2263
2271
|
while (1) switch (_context31.prev = _context31.next) {
|
|
2264
2272
|
case 0:
|
|
@@ -2334,7 +2342,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2334
2342
|
return _context31.abrupt("return", {
|
|
2335
2343
|
success: false,
|
|
2336
2344
|
message: "\u8BA2\u5355\u540C\u6B65\u5931\u8D25: ".concat(errorMessage),
|
|
2337
|
-
orderUuid: (_this$store$
|
|
2345
|
+
orderUuid: (_this$store$currentOr7 = this.store.currentOrder) === null || _this$store$currentOr7 === void 0 ? void 0 : _this$store$currentOr7.uuid
|
|
2338
2346
|
});
|
|
2339
2347
|
case 32:
|
|
2340
2348
|
case "end":
|
|
@@ -2411,15 +2419,15 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2411
2419
|
key: "cancelCurrentOrderAsync",
|
|
2412
2420
|
value: (function () {
|
|
2413
2421
|
var _cancelCurrentOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(cancelReason) {
|
|
2414
|
-
var _this$store$
|
|
2422
|
+
var _this$store$currentOr8, _this$store$currentOr9, currentOrderUuid, currentOrderId, isOrderSynced, errorMessage;
|
|
2415
2423
|
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
2416
2424
|
while (1) switch (_context32.prev = _context32.next) {
|
|
2417
2425
|
case 0:
|
|
2418
2426
|
_context32.prev = 0;
|
|
2419
2427
|
console.log('[Checkout] 开始取消当前本地订单:', {
|
|
2420
2428
|
hasCurrentOrder: !!this.store.currentOrder,
|
|
2421
|
-
orderUuid: (_this$store$
|
|
2422
|
-
orderId: (_this$store$
|
|
2429
|
+
orderUuid: (_this$store$currentOr8 = this.store.currentOrder) === null || _this$store$currentOr8 === void 0 ? void 0 : _this$store$currentOr8.uuid,
|
|
2430
|
+
orderId: (_this$store$currentOr9 = this.store.currentOrder) === null || _this$store$currentOr9 === void 0 ? void 0 : _this$store$currentOr9.order_id,
|
|
2423
2431
|
isOrderSynced: this.store.isOrderSynced,
|
|
2424
2432
|
cancelReason: cancelReason
|
|
2425
2433
|
});
|
|
@@ -2532,7 +2540,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2532
2540
|
key: "saveForLaterPaymentAsync",
|
|
2533
2541
|
value: (function () {
|
|
2534
2542
|
var _saveForLaterPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
2535
|
-
var orderUuid, currentOrderId, allPaymentItems, filteredPaymentItems, voucherItems, realOrderId, finalOrderId, _this$store$
|
|
2543
|
+
var orderUuid, currentOrderId, allPaymentItems, filteredPaymentItems, voucherItems, realOrderId, finalOrderId, _this$store$currentOr10, errorMessage;
|
|
2536
2544
|
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
2537
2545
|
while (1) switch (_context33.prev = _context33.next) {
|
|
2538
2546
|
case 0:
|
|
@@ -2622,7 +2630,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2622
2630
|
return _context33.abrupt("return", {
|
|
2623
2631
|
success: false,
|
|
2624
2632
|
message: "\u8BA2\u5355\u4FDD\u5B58\u5931\u8D25: ".concat(errorMessage),
|
|
2625
|
-
orderUuid: (_this$store$
|
|
2633
|
+
orderUuid: (_this$store$currentOr10 = this.store.currentOrder) === null || _this$store$currentOr10 === void 0 ? void 0 : _this$store$currentOr10.uuid
|
|
2626
2634
|
});
|
|
2627
2635
|
case 26:
|
|
2628
2636
|
case "end":
|
|
@@ -2673,14 +2681,14 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2673
2681
|
key: "updateShopDiscountAsync",
|
|
2674
2682
|
value: (function () {
|
|
2675
2683
|
var _updateShopDiscountAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(discountAmount) {
|
|
2676
|
-
var _this$store$
|
|
2684
|
+
var _this$store$currentOr11, _this$store$currentOr12, oldDiscount, shopDiscountItem, updatedAmountInfo;
|
|
2677
2685
|
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
2678
2686
|
while (1) switch (_context34.prev = _context34.next) {
|
|
2679
2687
|
case 0:
|
|
2680
2688
|
_context34.prev = 0;
|
|
2681
2689
|
oldDiscount = this.getShopDiscount();
|
|
2682
2690
|
console.log('[Checkout] 更新商店折扣:', {
|
|
2683
|
-
orderUuid: (_this$store$
|
|
2691
|
+
orderUuid: (_this$store$currentOr11 = this.store.currentOrder) === null || _this$store$currentOr11 === void 0 ? void 0 : _this$store$currentOr11.uuid,
|
|
2684
2692
|
oldDiscount: oldDiscount,
|
|
2685
2693
|
newDiscount: discountAmount
|
|
2686
2694
|
});
|
|
@@ -2730,7 +2738,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2730
2738
|
case 8:
|
|
2731
2739
|
_context34.next = 10;
|
|
2732
2740
|
return this.core.effects.emit(CheckoutHooks.OnShopDiscountChanged, {
|
|
2733
|
-
orderUuid: (_this$store$
|
|
2741
|
+
orderUuid: (_this$store$currentOr12 = this.store.currentOrder) === null || _this$store$currentOr12 === void 0 ? void 0 : _this$store$currentOr12.uuid,
|
|
2734
2742
|
oldDiscount: oldDiscount,
|
|
2735
2743
|
newDiscount: discountAmount,
|
|
2736
2744
|
timestamp: Date.now()
|
|
@@ -2771,7 +2779,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2771
2779
|
key: "updateOrderNoteAsync",
|
|
2772
2780
|
value: (function () {
|
|
2773
2781
|
var _updateOrderNoteAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(note) {
|
|
2774
|
-
var _this$store$
|
|
2782
|
+
var _this$store$currentOr13, _this$store$currentOr14, oldNote, orderInPayment;
|
|
2775
2783
|
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
2776
2784
|
while (1) switch (_context35.prev = _context35.next) {
|
|
2777
2785
|
case 0:
|
|
@@ -2783,7 +2791,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2783
2791
|
throw createCheckoutError(CheckoutErrorType.ValidationFailed, '没有本地订单数据,无法更新备注');
|
|
2784
2792
|
case 3:
|
|
2785
2793
|
console.log('[Checkout] 更新订单备注:', {
|
|
2786
|
-
orderUuid: (_this$store$
|
|
2794
|
+
orderUuid: (_this$store$currentOr13 = this.store.currentOrder) === null || _this$store$currentOr13 === void 0 ? void 0 : _this$store$currentOr13.uuid,
|
|
2787
2795
|
oldNote: this.store.localOrderData.shop_note,
|
|
2788
2796
|
newNote: note
|
|
2789
2797
|
});
|
|
@@ -2816,7 +2824,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2816
2824
|
case 17:
|
|
2817
2825
|
_context35.next = 19;
|
|
2818
2826
|
return this.core.effects.emit(CheckoutHooks.OnOrderNoteChanged, {
|
|
2819
|
-
orderUuid: (_this$store$
|
|
2827
|
+
orderUuid: (_this$store$currentOr14 = this.store.currentOrder) === null || _this$store$currentOr14 === void 0 ? void 0 : _this$store$currentOr14.uuid,
|
|
2820
2828
|
oldNote: oldNote,
|
|
2821
2829
|
newNote: note,
|
|
2822
2830
|
timestamp: Date.now()
|
|
@@ -2956,7 +2964,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2956
2964
|
key: "handlePaymentSuccess",
|
|
2957
2965
|
value: (function () {
|
|
2958
2966
|
var _handlePaymentSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(data) {
|
|
2959
|
-
var _this$store$
|
|
2967
|
+
var _this$store$currentOr15;
|
|
2960
2968
|
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
2961
2969
|
while (1) switch (_context39.prev = _context39.next) {
|
|
2962
2970
|
case 0:
|
|
@@ -2970,7 +2978,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2970
2978
|
return this.core.effects.emit(CheckoutHooks.OnPaymentSuccess, {
|
|
2971
2979
|
orderUuid: data.orderUuid,
|
|
2972
2980
|
paymentMethodCode: '',
|
|
2973
|
-
amount: ((_this$store$
|
|
2981
|
+
amount: ((_this$store$currentOr15 = this.store.currentOrder) === null || _this$store$currentOr15 === void 0 ? void 0 : _this$store$currentOr15.total_amount) || '0',
|
|
2974
2982
|
timestamp: data.timestamp
|
|
2975
2983
|
});
|
|
2976
2984
|
case 6:
|
|
@@ -2995,7 +3003,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2995
3003
|
key: "handlePaymentError",
|
|
2996
3004
|
value: (function () {
|
|
2997
3005
|
var _handlePaymentError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(data) {
|
|
2998
|
-
var _this$store$
|
|
3006
|
+
var _this$store$currentOr16;
|
|
2999
3007
|
var error;
|
|
3000
3008
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3001
3009
|
while (1) switch (_context40.prev = _context40.next) {
|
|
@@ -3008,7 +3016,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3008
3016
|
return this.core.effects.emit(CheckoutHooks.OnPaymentFailed, {
|
|
3009
3017
|
orderUuid: data.orderUuid,
|
|
3010
3018
|
paymentMethodCode: '',
|
|
3011
|
-
amount: ((_this$store$
|
|
3019
|
+
amount: ((_this$store$currentOr16 = this.store.currentOrder) === null || _this$store$currentOr16 === void 0 ? void 0 : _this$store$currentOr16.total_amount) || '0',
|
|
3012
3020
|
timestamp: data.timestamp
|
|
3013
3021
|
});
|
|
3014
3022
|
case 5:
|
|
@@ -3354,7 +3362,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3354
3362
|
key: "updateStateAmountToRemaining",
|
|
3355
3363
|
value: (function () {
|
|
3356
3364
|
var _updateStateAmountToRemaining = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
|
|
3357
|
-
var _this$store$
|
|
3365
|
+
var _this$store$currentOr17, remainingAmount, currentStateAmount;
|
|
3358
3366
|
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3359
3367
|
while (1) switch (_context46.prev = _context46.next) {
|
|
3360
3368
|
case 0:
|
|
@@ -3368,7 +3376,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3368
3376
|
calculatedRemainingAmount: remainingAmount,
|
|
3369
3377
|
currentStateAmount: currentStateAmount,
|
|
3370
3378
|
needsUpdate: remainingAmount !== currentStateAmount,
|
|
3371
|
-
orderUuid: (_this$store$
|
|
3379
|
+
orderUuid: (_this$store$currentOr17 = this.store.currentOrder) === null || _this$store$currentOr17 === void 0 ? void 0 : _this$store$currentOr17.uuid
|
|
3372
3380
|
});
|
|
3373
3381
|
|
|
3374
3382
|
// 只有当剩余金额与当前 stateAmount 不同时才更新
|
|
@@ -3599,7 +3607,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3599
3607
|
key: "syncOrderToBackendWithReturn",
|
|
3600
3608
|
value: (function () {
|
|
3601
3609
|
var _syncOrderToBackendWithReturn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
|
|
3602
|
-
var _this$store$currentCu2, _this$store$
|
|
3610
|
+
var _this$store$currentCu2, _this$store$currentOr18, _this$store$currentOr19;
|
|
3603
3611
|
var isManual,
|
|
3604
3612
|
customPaymentItems,
|
|
3605
3613
|
syncType,
|
|
@@ -3717,8 +3725,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3717
3725
|
currency_code: this.otherParams.currency_code,
|
|
3718
3726
|
currency_symbol: this.otherParams.currency_symbol,
|
|
3719
3727
|
currency_format: this.otherParams.currency_format,
|
|
3720
|
-
is_deposit: ((_this$store$
|
|
3721
|
-
deposit_amount: ((_this$store$
|
|
3728
|
+
is_deposit: ((_this$store$currentOr18 = this.store.currentOrder) === null || _this$store$currentOr18 === void 0 ? void 0 : _this$store$currentOr18.is_deposit) || 0,
|
|
3729
|
+
deposit_amount: ((_this$store$currentOr19 = this.store.currentOrder) === null || _this$store$currentOr19 === void 0 ? void 0 : _this$store$currentOr19.deposit_amount) || '0.00',
|
|
3722
3730
|
// surcharge_fee: this.otherParams.surcharge_fee,
|
|
3723
3731
|
// surcharges: ,
|
|
3724
3732
|
note: this.store.localOrderData.shop_note
|
|
@@ -4297,17 +4305,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4297
4305
|
// 清空购物车项目
|
|
4298
4306
|
this.store.cartItems = [];
|
|
4299
4307
|
|
|
4308
|
+
// 清理钱包缓存
|
|
4309
|
+
this.payment.wallet.clearAllCache();
|
|
4310
|
+
|
|
4300
4311
|
// 注意:故意保留 this.store.paymentMethods,因为支付方式数据不易变更,保留在内存中提高性能
|
|
4301
4312
|
|
|
4302
4313
|
// 重置状态和步骤为初始状态
|
|
4303
|
-
_context55.next =
|
|
4314
|
+
_context55.next = 14;
|
|
4304
4315
|
return this.setStatus(CheckoutStatus.Ready);
|
|
4305
|
-
case
|
|
4306
|
-
_context55.next =
|
|
4316
|
+
case 14:
|
|
4317
|
+
_context55.next = 16;
|
|
4307
4318
|
return this.setStep(CheckoutStep.OrderConfirmation);
|
|
4308
|
-
case
|
|
4309
|
-
// 清理钱包缓存
|
|
4310
|
-
this.payment.wallet.clearAllCache();
|
|
4319
|
+
case 16:
|
|
4311
4320
|
console.log('[Checkout] Store 状态重置完成');
|
|
4312
4321
|
|
|
4313
4322
|
// 触发订单清理事件(如果之前有订单)
|
|
@@ -10,7 +10,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
10
10
|
constructor(name?: string, version?: string);
|
|
11
11
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
12
12
|
createOrder(params: CommitOrderParams['query']): {
|
|
13
|
-
type: "
|
|
13
|
+
type: "virtual" | "appointment_booking";
|
|
14
14
|
platform: string;
|
|
15
15
|
sales_channel: string;
|
|
16
16
|
order_sales_channel: string;
|
|
@@ -476,6 +476,48 @@ export interface OnSearchIdentificationCodeCompletedEventData {
|
|
|
476
476
|
/** 搜索参数 */
|
|
477
477
|
searchParams: SearchIdentificationCodeParams;
|
|
478
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* 钱包初始化开始事件数据
|
|
481
|
+
*/
|
|
482
|
+
export interface OnWalletInitializationStartedEventData {
|
|
483
|
+
/** 业务数据 */
|
|
484
|
+
businessData: WalletInitBusinessData;
|
|
485
|
+
/** 开始时间 */
|
|
486
|
+
startTime: number;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* 钱包初始化完成事件数据
|
|
490
|
+
*/
|
|
491
|
+
export interface OnWalletInitializationCompletedEventData {
|
|
492
|
+
/** 业务数据 */
|
|
493
|
+
businessData: WalletInitBusinessData;
|
|
494
|
+
/** 初始化结果 */
|
|
495
|
+
result: {
|
|
496
|
+
walletRecommendList: WalletRecommendItem[];
|
|
497
|
+
userIdentificationCodes: UserIdentificationCodeItem[];
|
|
498
|
+
};
|
|
499
|
+
/** 开始时间 */
|
|
500
|
+
startTime: number;
|
|
501
|
+
/** 结束时间 */
|
|
502
|
+
endTime: number;
|
|
503
|
+
/** 执行时长(毫秒) */
|
|
504
|
+
duration: number;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* 钱包初始化失败事件数据
|
|
508
|
+
*/
|
|
509
|
+
export interface OnWalletInitializationFailedEventData {
|
|
510
|
+
/** 业务数据 */
|
|
511
|
+
businessData: WalletInitBusinessData;
|
|
512
|
+
/** 错误信息 */
|
|
513
|
+
error: Error;
|
|
514
|
+
/** 开始时间 */
|
|
515
|
+
startTime: number;
|
|
516
|
+
/** 结束时间 */
|
|
517
|
+
endTime: number;
|
|
518
|
+
/** 执行时长(毫秒) */
|
|
519
|
+
duration: number;
|
|
520
|
+
}
|
|
479
521
|
/**
|
|
480
522
|
* 钱包支付事件枚举
|
|
481
523
|
*/
|
|
@@ -485,7 +527,10 @@ export declare enum WalletPassHooks {
|
|
|
485
527
|
OnUserIdentificationCodesUpdated = "wallet:onUserIdentificationCodesUpdated",
|
|
486
528
|
OnUserIdentificationCodesCleared = "wallet:onUserIdentificationCodesCleared",
|
|
487
529
|
OnWalletCacheCleared = "wallet:onWalletCacheCleared",
|
|
488
|
-
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted"
|
|
530
|
+
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted",
|
|
531
|
+
OnWalletInitializationStarted = "wallet:onWalletInitializationStarted",
|
|
532
|
+
OnWalletInitializationCompleted = "wallet:onWalletInitializationCompleted",
|
|
533
|
+
OnWalletInitializationFailed = "wallet:onWalletInitializationFailed"
|
|
489
534
|
}
|
|
490
535
|
/**
|
|
491
536
|
* 支付钩子事件(统一接口)
|
|
@@ -69,6 +69,9 @@ var WalletPassHooks = /* @__PURE__ */ ((WalletPassHooks2) => {
|
|
|
69
69
|
WalletPassHooks2["OnUserIdentificationCodesCleared"] = "wallet:onUserIdentificationCodesCleared";
|
|
70
70
|
WalletPassHooks2["OnWalletCacheCleared"] = "wallet:onWalletCacheCleared";
|
|
71
71
|
WalletPassHooks2["OnSearchIdentificationCodeCompleted"] = "wallet:onSearchIdentificationCodeCompleted";
|
|
72
|
+
WalletPassHooks2["OnWalletInitializationStarted"] = "wallet:onWalletInitializationStarted";
|
|
73
|
+
WalletPassHooks2["OnWalletInitializationCompleted"] = "wallet:onWalletInitializationCompleted";
|
|
74
|
+
WalletPassHooks2["OnWalletInitializationFailed"] = "wallet:onWalletInitializationFailed";
|
|
72
75
|
return WalletPassHooks2;
|
|
73
76
|
})(WalletPassHooks || {});
|
|
74
77
|
var PaymentHooks = /* @__PURE__ */ ((PaymentHooks2) => {
|
|
@@ -88,11 +88,36 @@ var WalletPassPaymentImpl = class {
|
|
|
88
88
|
* 内部生成参数,然后调用标准的初始化流程
|
|
89
89
|
*/
|
|
90
90
|
async initializeWalletDataFromBusinessAsync(businessData) {
|
|
91
|
+
const startTime = Date.now();
|
|
92
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationStarted, {
|
|
93
|
+
businessData,
|
|
94
|
+
startTime
|
|
95
|
+
});
|
|
91
96
|
try {
|
|
92
97
|
const walletParams = this.generateWalletParams(businessData);
|
|
93
|
-
|
|
98
|
+
const result = await this.initializeWalletDataAsync(walletParams);
|
|
99
|
+
const endTime = Date.now();
|
|
100
|
+
const duration = endTime - startTime;
|
|
101
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationCompleted, {
|
|
102
|
+
businessData,
|
|
103
|
+
result,
|
|
104
|
+
startTime,
|
|
105
|
+
endTime,
|
|
106
|
+
duration
|
|
107
|
+
});
|
|
108
|
+
console.log(`[WalletPass] 从业务数据初始化钱包数据成功,耗时: ${duration}ms`);
|
|
109
|
+
return result;
|
|
94
110
|
} catch (error) {
|
|
95
|
-
|
|
111
|
+
const endTime = Date.now();
|
|
112
|
+
const duration = endTime - startTime;
|
|
113
|
+
this.emitEvent(import_types.WalletPassHooks.OnWalletInitializationFailed, {
|
|
114
|
+
businessData,
|
|
115
|
+
error,
|
|
116
|
+
startTime,
|
|
117
|
+
endTime,
|
|
118
|
+
duration
|
|
119
|
+
});
|
|
120
|
+
console.error(`[WalletPass] 从业务数据初始化钱包数据失败,耗时: ${duration}ms`, error);
|
|
96
121
|
throw error;
|
|
97
122
|
}
|
|
98
123
|
}
|
|
@@ -111,7 +111,7 @@ export declare class BookingTicketImpl extends BaseModule implements Module {
|
|
|
111
111
|
* 获取当前的客户搜索条件
|
|
112
112
|
* @returns 当前搜索条件
|
|
113
113
|
*/
|
|
114
|
-
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "
|
|
114
|
+
getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
|
|
115
115
|
/**
|
|
116
116
|
* 获取客户列表状态(包含滚动加载相关状态)
|
|
117
117
|
* @returns 客户状态
|
|
@@ -137,7 +137,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
getProductListByOrder() {
|
|
140
|
-
var _a;
|
|
140
|
+
var _a, _b, _c, _d, _e;
|
|
141
141
|
if (!this.store.currentOrder) {
|
|
142
142
|
return [];
|
|
143
143
|
}
|
|
@@ -146,15 +146,21 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
146
146
|
return pre + (item.amount || 0);
|
|
147
147
|
}, 0);
|
|
148
148
|
};
|
|
149
|
-
const productList = (_a = this.store.currentOrder.order_info) == null ? void 0 : _a.original_order_data.bookings.map(
|
|
149
|
+
const productList = ((_b = (_a = this.store.currentOrder.order_info) == null ? void 0 : _a.original_order_data.bookings) == null ? void 0 : _b.map(
|
|
150
150
|
(item) => ({
|
|
151
151
|
product_id: item.product.product_id,
|
|
152
152
|
product_variant_id: item.product.product_variant_id,
|
|
153
153
|
quantity: item.product.num,
|
|
154
154
|
selling_price: item.product.price - (item.product.discount_amount || 0) - getDiscountListAmount(item.product.discount_list)
|
|
155
155
|
})
|
|
156
|
-
);
|
|
157
|
-
|
|
156
|
+
)) || [];
|
|
157
|
+
const relationProducts = ((_e = (_d = (_c = this.store.currentOrder.order_info) == null ? void 0 : _c.original_order_data) == null ? void 0 : _d.relation_products) == null ? void 0 : _e.map((item) => ({
|
|
158
|
+
product_id: item.product_id,
|
|
159
|
+
product_variant_id: item.product_variant_id,
|
|
160
|
+
quantity: item.num,
|
|
161
|
+
selling_price: item.source_product_price
|
|
162
|
+
}))) || [];
|
|
163
|
+
return [...productList, ...relationProducts];
|
|
158
164
|
}
|
|
159
165
|
async initWalletData(params) {
|
|
160
166
|
var _a, _b, _c;
|
|
@@ -2535,9 +2541,9 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2535
2541
|
this.store.currentCustomer = void 0;
|
|
2536
2542
|
this.store.lastError = void 0;
|
|
2537
2543
|
this.store.cartItems = [];
|
|
2544
|
+
this.payment.wallet.clearAllCache();
|
|
2538
2545
|
await this.setStatus(import_types.CheckoutStatus.Ready);
|
|
2539
2546
|
await this.setStep(import_types.CheckoutStep.OrderConfirmation);
|
|
2540
|
-
this.payment.wallet.clearAllCache();
|
|
2541
2547
|
console.log("[Checkout] Store 状态重置完成");
|
|
2542
2548
|
if (prevOrderInfo) {
|
|
2543
2549
|
await this.core.effects.emit(import_types.CheckoutHooks.OnOrderCleared, {
|