@pisell/pisellos 0.0.409 → 0.0.411
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.
|
@@ -3,12 +3,12 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
5
5
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
6
|
+
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; } } }; }
|
|
6
7
|
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; }
|
|
7
8
|
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; }
|
|
8
9
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
11
|
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); }
|
|
11
|
-
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; } } }; }
|
|
12
12
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
13
|
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."); }
|
|
14
14
|
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); }
|
|
@@ -153,7 +153,12 @@ export var getTax = function getTax(_ref, options) {
|
|
|
153
153
|
if (service || addons) {
|
|
154
154
|
// 处理服务商品
|
|
155
155
|
if (service !== null && service !== void 0 && service.length) {
|
|
156
|
-
var serviceResult = processItemsTax(service
|
|
156
|
+
var serviceResult = processItemsTax(service.map(function (item) {
|
|
157
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
158
|
+
option: (item === null || item === void 0 ? void 0 : item.option) || (item === null || item === void 0 ? void 0 : item.options) || [],
|
|
159
|
+
bundle: (item === null || item === void 0 ? void 0 : item.bundle) || (item === null || item === void 0 ? void 0 : item.bundles) || []
|
|
160
|
+
});
|
|
161
|
+
}), {
|
|
157
162
|
bookingDetail: bookingDetail,
|
|
158
163
|
bookingId: bookingId
|
|
159
164
|
}, {
|
|
@@ -222,7 +227,10 @@ var processItemsTax = function processItemsTax(items, _ref2, options) {
|
|
|
222
227
|
var item = _step.value;
|
|
223
228
|
var quantity = new Decimal(item.num || 1);
|
|
224
229
|
var unitPrice = new Decimal(item.total || 0);
|
|
225
|
-
var mainProductPrice = new Decimal(getMainProductTotal(item)
|
|
230
|
+
var mainProductPrice = new Decimal(getMainProductTotal(_objectSpread(_objectSpread({}, item), {}, {
|
|
231
|
+
option: (item === null || item === void 0 ? void 0 : item.option) || (item === null || item === void 0 ? void 0 : item.options) || [],
|
|
232
|
+
bundle: (item === null || item === void 0 ? void 0 : item.bundle) || (item === null || item === void 0 ? void 0 : item.bundles) || []
|
|
233
|
+
})) || 0);
|
|
226
234
|
|
|
227
235
|
// 计算原始税费(折扣前)- 单个商品(精确值)
|
|
228
236
|
var originalTaxPerItemPrecise = getProductItemTax(_objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -895,7 +903,10 @@ export var getSurcharge = function getSurcharge(_ref10, options) {
|
|
|
895
903
|
isInScheduleByDate: isInScheduleByDate
|
|
896
904
|
})) {
|
|
897
905
|
// 主商品加价减价后的总价
|
|
898
|
-
var total = getMainProductTotal(item)
|
|
906
|
+
var total = getMainProductTotal(_objectSpread(_objectSpread({}, item), {}, {
|
|
907
|
+
option: (item === null || item === void 0 ? void 0 : item.option) || (item === null || item === void 0 ? void 0 : item.options) || [],
|
|
908
|
+
bundle: (item === null || item === void 0 ? void 0 : item.bundle) || (item === null || item === void 0 ? void 0 : item.bundles) || []
|
|
909
|
+
}));
|
|
899
910
|
var mainQuantity = item.num || 1;
|
|
900
911
|
matchedItems.push({
|
|
901
912
|
total: total,
|
|
@@ -1239,7 +1239,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1239
1239
|
key: "replaceLocalOrderIdAsync",
|
|
1240
1240
|
value: (function () {
|
|
1241
1241
|
var _replaceLocalOrderIdAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(newOrderId) {
|
|
1242
|
-
var updatedOrder;
|
|
1242
|
+
var previousOrder, latestPaymentStatus, updatedOrder;
|
|
1243
1243
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1244
1244
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1245
1245
|
case 0:
|
|
@@ -1251,24 +1251,38 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1251
1251
|
console.warn('[Checkout] 没有当前订单,无法替换订单ID');
|
|
1252
1252
|
return _context13.abrupt("return", null);
|
|
1253
1253
|
case 4:
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1254
|
+
previousOrder = this.store.currentOrder;
|
|
1255
|
+
latestPaymentStatus = previousOrder.payment_status;
|
|
1256
|
+
_context13.next = 8;
|
|
1257
|
+
return this.payment.replaceOrderIdByUuidAsync(previousOrder.uuid, newOrderId);
|
|
1258
|
+
case 8:
|
|
1257
1259
|
updatedOrder = _context13.sent;
|
|
1258
1260
|
if (!updatedOrder) {
|
|
1259
|
-
_context13.next =
|
|
1261
|
+
_context13.next = 20;
|
|
1260
1262
|
break;
|
|
1261
1263
|
}
|
|
1262
|
-
//
|
|
1263
|
-
|
|
1264
|
+
// 🔧 重要:Payment.replaceOrderIdByUuidAsync 返回的是 DB 快照(只保证 order_id 变化)
|
|
1265
|
+
// 这里需要合并到内存态,避免覆盖掉刚刚从后端拿到的 payment_status 等字段
|
|
1266
|
+
this.store.currentOrder = _objectSpread(_objectSpread(_objectSpread({}, previousOrder), updatedOrder), {}, {
|
|
1267
|
+
payment_status: latestPaymentStatus
|
|
1268
|
+
});
|
|
1264
1269
|
|
|
1265
|
-
//
|
|
1266
|
-
|
|
1270
|
+
// 同步更新 Payment 模块 DB,避免后续再次从 DB 读回旧的 payment_status
|
|
1271
|
+
if (!latestPaymentStatus) {
|
|
1272
|
+
_context13.next = 14;
|
|
1273
|
+
break;
|
|
1274
|
+
}
|
|
1275
|
+
_context13.next = 14;
|
|
1276
|
+
return this.payment.updateOrderAsync(previousOrder.uuid, {
|
|
1277
|
+
payment_status: latestPaymentStatus
|
|
1278
|
+
});
|
|
1279
|
+
case 14:
|
|
1280
|
+
_context13.next = 16;
|
|
1267
1281
|
return this.core.effects.emit("".concat(this.name, ":onOrderCreated"), {
|
|
1268
1282
|
order: updatedOrder,
|
|
1269
1283
|
timestamp: Date.now()
|
|
1270
1284
|
});
|
|
1271
|
-
case
|
|
1285
|
+
case 16:
|
|
1272
1286
|
console.log('[Checkout] 本地订单ID替换成功:', {
|
|
1273
1287
|
uuid: updatedOrder.uuid,
|
|
1274
1288
|
newOrderId: updatedOrder.id
|
|
@@ -1278,23 +1292,23 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1278
1292
|
this.store.isOrderSynced = true;
|
|
1279
1293
|
|
|
1280
1294
|
// 订单ID替换后更新 stateAmount
|
|
1281
|
-
_context13.next =
|
|
1295
|
+
_context13.next = 20;
|
|
1282
1296
|
return this.updateStateAmountToRemaining(false);
|
|
1283
|
-
case
|
|
1297
|
+
case 20:
|
|
1284
1298
|
return _context13.abrupt("return", updatedOrder);
|
|
1285
|
-
case
|
|
1286
|
-
_context13.prev =
|
|
1299
|
+
case 23:
|
|
1300
|
+
_context13.prev = 23;
|
|
1287
1301
|
_context13.t0 = _context13["catch"](0);
|
|
1288
1302
|
console.error('[Checkout] 替换订单ID失败:', _context13.t0);
|
|
1289
|
-
_context13.next =
|
|
1303
|
+
_context13.next = 28;
|
|
1290
1304
|
return this.handleError(_context13.t0, CheckoutErrorType.UnknownError);
|
|
1291
|
-
case
|
|
1305
|
+
case 28:
|
|
1292
1306
|
return _context13.abrupt("return", null);
|
|
1293
|
-
case
|
|
1307
|
+
case 29:
|
|
1294
1308
|
case "end":
|
|
1295
1309
|
return _context13.stop();
|
|
1296
1310
|
}
|
|
1297
|
-
}, _callee13, this, [[0,
|
|
1311
|
+
}, _callee13, this, [[0, 23]]);
|
|
1298
1312
|
}));
|
|
1299
1313
|
function replaceLocalOrderIdAsync(_x13) {
|
|
1300
1314
|
return _replaceLocalOrderIdAsync.apply(this, arguments);
|
|
@@ -3782,6 +3796,8 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3782
3796
|
_checkoutResponse6,
|
|
3783
3797
|
extractedOrderId,
|
|
3784
3798
|
_checkoutResponse7,
|
|
3799
|
+
latestPaymentStatus,
|
|
3800
|
+
previousOrder,
|
|
3785
3801
|
updatedOrder,
|
|
3786
3802
|
beforeManualUpdate,
|
|
3787
3803
|
syncedPaymentUuids,
|
|
@@ -4065,7 +4081,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4065
4081
|
}
|
|
4066
4082
|
// 更新操作:使用现有的订单ID
|
|
4067
4083
|
realOrderId = currentOrderId;
|
|
4068
|
-
_context39.next =
|
|
4084
|
+
_context39.next = 97;
|
|
4069
4085
|
break;
|
|
4070
4086
|
case 64:
|
|
4071
4087
|
// 创建操作:从响应中提取新的订单ID
|
|
@@ -4090,90 +4106,112 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4090
4106
|
newOrderId: realOrderId
|
|
4091
4107
|
});
|
|
4092
4108
|
_context39.prev = 70;
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4109
|
+
latestPaymentStatus = this.store.currentOrder.payment_status;
|
|
4110
|
+
previousOrder = this.store.currentOrder;
|
|
4111
|
+
_context39.next = 75;
|
|
4112
|
+
return this.payment.replaceOrderIdByUuidAsync(previousOrder.uuid, realOrderId);
|
|
4113
|
+
case 75:
|
|
4096
4114
|
updatedOrder = _context39.sent;
|
|
4097
4115
|
this.logInfo('Payment模块替换订单ID结果:', {
|
|
4098
4116
|
wasSuccessful: !!updatedOrder,
|
|
4099
4117
|
returnedOrderId: updatedOrder === null || updatedOrder === void 0 ? void 0 : updatedOrder.order_id,
|
|
4100
4118
|
expectedOrderId: realOrderId
|
|
4101
4119
|
});
|
|
4102
|
-
if (updatedOrder) {
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
}
|
|
4111
|
-
this.logError('[Checkout] Payment模块返回空订单,订单ID替换失败,开始手动替换');
|
|
4120
|
+
if (!updatedOrder) {
|
|
4121
|
+
_context39.next = 86;
|
|
4122
|
+
break;
|
|
4123
|
+
}
|
|
4124
|
+
this.logInfo('Payment模块返回的更新后订单:', {
|
|
4125
|
+
uuid: updatedOrder.uuid,
|
|
4126
|
+
orderId: updatedOrder.order_id,
|
|
4127
|
+
totalAmount: updatedOrder.total_amount
|
|
4128
|
+
});
|
|
4112
4129
|
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4130
|
+
// 🔧 合并 DB 快照到内存态,避免覆盖 payment_status(以及其它刚更新过的内存字段)
|
|
4131
|
+
this.store.currentOrder = _objectSpread(_objectSpread(_objectSpread({}, previousOrder), updatedOrder), {}, {
|
|
4132
|
+
payment_status: latestPaymentStatus
|
|
4133
|
+
});
|
|
4134
|
+
|
|
4135
|
+
// 同步更新 Payment 模块 DB,避免后续读取 DB 时又拿回旧状态
|
|
4136
|
+
if (!latestPaymentStatus) {
|
|
4137
|
+
_context39.next = 83;
|
|
4138
|
+
break;
|
|
4121
4139
|
}
|
|
4122
4140
|
_context39.next = 83;
|
|
4141
|
+
return this.payment.updateOrderAsync(previousOrder.uuid, {
|
|
4142
|
+
payment_status: latestPaymentStatus
|
|
4143
|
+
});
|
|
4144
|
+
case 83:
|
|
4145
|
+
this.logInfo('[Checkout] 订单ID替换成功,当前订单ID:', this.store.currentOrder.order_id);
|
|
4146
|
+
_context39.next = 90;
|
|
4123
4147
|
break;
|
|
4124
|
-
case
|
|
4125
|
-
|
|
4148
|
+
case 86:
|
|
4149
|
+
this.logError('[Checkout] Payment模块返回空订单,订单ID替换失败,开始手动替换');
|
|
4150
|
+
|
|
4151
|
+
// 如果替换失败,手动更新订单ID
|
|
4152
|
+
beforeManualUpdate = this.store.currentOrder.order_id;
|
|
4153
|
+
this.store.currentOrder.order_id = realOrderId;
|
|
4154
|
+
this.logInfo('手动设置订单ID:', {
|
|
4155
|
+
beforeReplacement: beforeManualUpdate,
|
|
4156
|
+
afterReplacement: this.store.currentOrder.order_id,
|
|
4157
|
+
目标ID: realOrderId
|
|
4158
|
+
});
|
|
4159
|
+
case 90:
|
|
4160
|
+
_context39.next = 97;
|
|
4161
|
+
break;
|
|
4162
|
+
case 92:
|
|
4163
|
+
_context39.prev = 92;
|
|
4126
4164
|
_context39.t2 = _context39["catch"](70);
|
|
4127
4165
|
this.logError('调用Payment模块替换订单ID时发生错误:', _context39.t2);
|
|
4128
4166
|
|
|
4129
4167
|
// 发生错误时也进行手动替换
|
|
4130
4168
|
this.store.currentOrder.order_id = realOrderId;
|
|
4131
4169
|
this.logInfo('错误恢复:手动设置订单ID:', realOrderId);
|
|
4132
|
-
case
|
|
4133
|
-
_context39.prev =
|
|
4170
|
+
case 97:
|
|
4171
|
+
_context39.prev = 97;
|
|
4134
4172
|
syncedPaymentUuids = processedPaymentItems.filter(function (item) {
|
|
4135
4173
|
return item.status !== 'voided';
|
|
4136
4174
|
}).map(function (item) {
|
|
4137
4175
|
return item.uuid;
|
|
4138
4176
|
}).filter(Boolean);
|
|
4139
4177
|
_iterator3 = _createForOfIteratorHelper(syncedPaymentUuids);
|
|
4140
|
-
_context39.prev =
|
|
4178
|
+
_context39.prev = 100;
|
|
4141
4179
|
_iterator3.s();
|
|
4142
|
-
case
|
|
4180
|
+
case 102:
|
|
4143
4181
|
if ((_step3 = _iterator3.n()).done) {
|
|
4144
|
-
_context39.next =
|
|
4182
|
+
_context39.next = 108;
|
|
4145
4183
|
break;
|
|
4146
4184
|
}
|
|
4147
4185
|
paymentUuid = _step3.value;
|
|
4148
|
-
_context39.next =
|
|
4186
|
+
_context39.next = 106;
|
|
4149
4187
|
return this.payment.updatePaymentAsync(this.store.currentOrder.uuid, paymentUuid, {
|
|
4150
4188
|
isSynced: true,
|
|
4151
4189
|
syncError: undefined
|
|
4152
4190
|
});
|
|
4153
|
-
case
|
|
4154
|
-
_context39.next =
|
|
4191
|
+
case 106:
|
|
4192
|
+
_context39.next = 102;
|
|
4155
4193
|
break;
|
|
4156
|
-
case
|
|
4157
|
-
_context39.next =
|
|
4194
|
+
case 108:
|
|
4195
|
+
_context39.next = 113;
|
|
4158
4196
|
break;
|
|
4159
|
-
case
|
|
4160
|
-
_context39.prev =
|
|
4161
|
-
_context39.t3 = _context39["catch"](
|
|
4197
|
+
case 110:
|
|
4198
|
+
_context39.prev = 110;
|
|
4199
|
+
_context39.t3 = _context39["catch"](100);
|
|
4162
4200
|
_iterator3.e(_context39.t3);
|
|
4163
|
-
case
|
|
4164
|
-
_context39.prev =
|
|
4201
|
+
case 113:
|
|
4202
|
+
_context39.prev = 113;
|
|
4165
4203
|
_iterator3.f();
|
|
4166
|
-
return _context39.finish(
|
|
4167
|
-
case
|
|
4168
|
-
_context39.next =
|
|
4204
|
+
return _context39.finish(113);
|
|
4205
|
+
case 116:
|
|
4206
|
+
_context39.next = 121;
|
|
4169
4207
|
break;
|
|
4170
|
-
case
|
|
4171
|
-
_context39.prev =
|
|
4172
|
-
_context39.t4 = _context39["catch"](
|
|
4208
|
+
case 118:
|
|
4209
|
+
_context39.prev = 118;
|
|
4210
|
+
_context39.t4 = _context39["catch"](97);
|
|
4173
4211
|
this.logWarning('标记支付项已同步失败(不阻塞主流程)', {
|
|
4174
4212
|
error: _context39.t4
|
|
4175
4213
|
});
|
|
4176
|
-
case
|
|
4214
|
+
case 121:
|
|
4177
4215
|
// 标记订单已同步
|
|
4178
4216
|
this.store.isOrderSynced = true;
|
|
4179
4217
|
|
|
@@ -4181,7 +4219,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4181
4219
|
this.clearCalculationCache();
|
|
4182
4220
|
|
|
4183
4221
|
// 触发订单同步完成事件
|
|
4184
|
-
_context39.next =
|
|
4222
|
+
_context39.next = 125;
|
|
4185
4223
|
return this.core.effects.emit("".concat(this.name, ":onOrderSynced"), {
|
|
4186
4224
|
orderUuid: this.store.currentOrder.uuid,
|
|
4187
4225
|
realOrderId: realOrderId,
|
|
@@ -4190,18 +4228,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4190
4228
|
isManual: isManual,
|
|
4191
4229
|
response: checkoutResponse
|
|
4192
4230
|
});
|
|
4193
|
-
case
|
|
4231
|
+
case 125:
|
|
4194
4232
|
return _context39.abrupt("return", {
|
|
4195
4233
|
success: true,
|
|
4196
4234
|
orderId: realOrderId,
|
|
4197
4235
|
orderUuid: this.store.currentOrder.uuid,
|
|
4198
4236
|
response: checkoutResponse
|
|
4199
4237
|
});
|
|
4200
|
-
case
|
|
4238
|
+
case 126:
|
|
4201
4239
|
case "end":
|
|
4202
4240
|
return _context39.stop();
|
|
4203
4241
|
}
|
|
4204
|
-
}, _callee39, this, [[31, 41, 49, 53], [70,
|
|
4242
|
+
}, _callee39, this, [[31, 41, 49, 53], [70, 92], [97, 118], [100, 110, 113, 116]]);
|
|
4205
4243
|
}));
|
|
4206
4244
|
function syncOrderToBackendWithReturn() {
|
|
4207
4245
|
return _syncOrderToBackendWithReturn.apply(this, arguments);
|
|
@@ -99,7 +99,13 @@ var getTax = ({ service, addons, bookingDetail, bookingId }, options) => {
|
|
|
99
99
|
let totalTax = new import_decimal.default(0);
|
|
100
100
|
if (service || addons) {
|
|
101
101
|
if (service == null ? void 0 : service.length) {
|
|
102
|
-
const serviceResult = processItemsTax(service
|
|
102
|
+
const serviceResult = processItemsTax(service.map((item) => {
|
|
103
|
+
return {
|
|
104
|
+
...item,
|
|
105
|
+
option: (item == null ? void 0 : item.option) || (item == null ? void 0 : item.options) || [],
|
|
106
|
+
bundle: (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || []
|
|
107
|
+
};
|
|
108
|
+
}), { bookingDetail, bookingId }, {
|
|
103
109
|
tax_rate,
|
|
104
110
|
is_price_include_tax,
|
|
105
111
|
computed
|
|
@@ -133,7 +139,11 @@ var processItemsTax = (items, { bookingDetail, bookingId }, options) => {
|
|
|
133
139
|
for (let item of items) {
|
|
134
140
|
const quantity = new import_decimal.default(item.num || 1);
|
|
135
141
|
const unitPrice = new import_decimal.default(item.total || 0);
|
|
136
|
-
const mainProductPrice = new import_decimal.default(getMainProductTotal(
|
|
142
|
+
const mainProductPrice = new import_decimal.default(getMainProductTotal({
|
|
143
|
+
...item,
|
|
144
|
+
option: (item == null ? void 0 : item.option) || (item == null ? void 0 : item.options) || [],
|
|
145
|
+
bundle: (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || []
|
|
146
|
+
}) || 0);
|
|
137
147
|
let originalTaxPerItemPrecise = getProductItemTax(
|
|
138
148
|
{
|
|
139
149
|
...item,
|
|
@@ -531,7 +541,11 @@ var getSurcharge = ({ service, addons, bookingDetail, bookingId }, options) => {
|
|
|
531
541
|
isInScheduleByDate
|
|
532
542
|
}
|
|
533
543
|
)) {
|
|
534
|
-
const total = getMainProductTotal(
|
|
544
|
+
const total = getMainProductTotal({
|
|
545
|
+
...item,
|
|
546
|
+
option: (item == null ? void 0 : item.option) || (item == null ? void 0 : item.options) || [],
|
|
547
|
+
bundle: (item == null ? void 0 : item.bundle) || (item == null ? void 0 : item.bundles) || []
|
|
548
|
+
});
|
|
535
549
|
const mainQuantity = item.num || 1;
|
|
536
550
|
matchedItems.push({
|
|
537
551
|
total,
|
|
@@ -859,12 +859,22 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
859
859
|
console.warn("[Checkout] 没有当前订单,无法替换订单ID");
|
|
860
860
|
return null;
|
|
861
861
|
}
|
|
862
|
+
const previousOrder = this.store.currentOrder;
|
|
863
|
+
const latestPaymentStatus = previousOrder.payment_status;
|
|
862
864
|
const updatedOrder = await this.payment.replaceOrderIdByUuidAsync(
|
|
863
|
-
|
|
865
|
+
previousOrder.uuid,
|
|
864
866
|
newOrderId
|
|
865
867
|
);
|
|
866
868
|
if (updatedOrder) {
|
|
867
|
-
this.store.currentOrder =
|
|
869
|
+
this.store.currentOrder = {
|
|
870
|
+
...previousOrder,
|
|
871
|
+
...updatedOrder,
|
|
872
|
+
payment_status: latestPaymentStatus
|
|
873
|
+
};
|
|
874
|
+
if (latestPaymentStatus)
|
|
875
|
+
await this.payment.updateOrderAsync(previousOrder.uuid, {
|
|
876
|
+
payment_status: latestPaymentStatus
|
|
877
|
+
});
|
|
868
878
|
await this.core.effects.emit(`${this.name}:onOrderCreated`, {
|
|
869
879
|
order: updatedOrder,
|
|
870
880
|
timestamp: Date.now()
|
|
@@ -2586,8 +2596,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2586
2596
|
newOrderId: realOrderId
|
|
2587
2597
|
});
|
|
2588
2598
|
try {
|
|
2599
|
+
const latestPaymentStatus = this.store.currentOrder.payment_status;
|
|
2600
|
+
const previousOrder = this.store.currentOrder;
|
|
2589
2601
|
const updatedOrder = await this.payment.replaceOrderIdByUuidAsync(
|
|
2590
|
-
|
|
2602
|
+
previousOrder.uuid,
|
|
2591
2603
|
realOrderId
|
|
2592
2604
|
);
|
|
2593
2605
|
this.logInfo("Payment模块替换订单ID结果:", {
|
|
@@ -2601,7 +2613,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2601
2613
|
orderId: updatedOrder.order_id,
|
|
2602
2614
|
totalAmount: updatedOrder.total_amount
|
|
2603
2615
|
});
|
|
2604
|
-
this.store.currentOrder =
|
|
2616
|
+
this.store.currentOrder = {
|
|
2617
|
+
...previousOrder,
|
|
2618
|
+
...updatedOrder,
|
|
2619
|
+
payment_status: latestPaymentStatus
|
|
2620
|
+
};
|
|
2621
|
+
if (latestPaymentStatus)
|
|
2622
|
+
await this.payment.updateOrderAsync(previousOrder.uuid, {
|
|
2623
|
+
payment_status: latestPaymentStatus
|
|
2624
|
+
});
|
|
2605
2625
|
this.logInfo(
|
|
2606
2626
|
"[Checkout] 订单ID替换成功,当前订单ID:",
|
|
2607
2627
|
this.store.currentOrder.order_id
|