@pisell/pisellos 0.0.408 → 0.0.410
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.
|
@@ -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,
|
|
@@ -3997,18 +4013,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3997
4013
|
case 35:
|
|
3998
4014
|
checkoutResponse = _context39.sent;
|
|
3999
4015
|
submitSuccess = true;
|
|
4016
|
+
this.store.currentOrder.payment_status = checkoutResponse.data.payment_status;
|
|
4000
4017
|
this.logInfo('下单接口调用成功', checkoutResponse);
|
|
4001
|
-
_context39.next =
|
|
4018
|
+
_context39.next = 49;
|
|
4002
4019
|
break;
|
|
4003
|
-
case
|
|
4004
|
-
_context39.prev =
|
|
4020
|
+
case 41:
|
|
4021
|
+
_context39.prev = 41;
|
|
4005
4022
|
_context39.t1 = _context39["catch"](31);
|
|
4006
4023
|
submitSuccess = false;
|
|
4007
4024
|
submitError = _context39.t1 instanceof Error ? _context39.t1.message : String(_context39.t1);
|
|
4008
4025
|
this.logError('下单接口调用失败:', submitError);
|
|
4009
4026
|
|
|
4010
4027
|
// 发送订单同步失败事件(网络错误或请求失败)
|
|
4011
|
-
_context39.next =
|
|
4028
|
+
_context39.next = 48;
|
|
4012
4029
|
return this.core.effects.emit("".concat(this.name, ":onOrderSyncFailed"), {
|
|
4013
4030
|
orderUuid: this.store.currentOrder.uuid,
|
|
4014
4031
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
@@ -4018,11 +4035,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4018
4035
|
duration: Date.now() - startTime,
|
|
4019
4036
|
timestamp: Date.now()
|
|
4020
4037
|
});
|
|
4021
|
-
case 47:
|
|
4022
|
-
throw _context39.t1;
|
|
4023
4038
|
case 48:
|
|
4024
|
-
_context39.
|
|
4025
|
-
|
|
4039
|
+
throw _context39.t1;
|
|
4040
|
+
case 49:
|
|
4041
|
+
_context39.prev = 49;
|
|
4042
|
+
_context39.next = 52;
|
|
4026
4043
|
return this.core.effects.emit("".concat(this.name, ":onOrderSubmitEnd"), {
|
|
4027
4044
|
success: submitSuccess,
|
|
4028
4045
|
orderUuid: this.store.currentOrder.uuid,
|
|
@@ -4033,18 +4050,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4033
4050
|
duration: Date.now() - startTime,
|
|
4034
4051
|
timestamp: Date.now()
|
|
4035
4052
|
});
|
|
4036
|
-
case 51:
|
|
4037
|
-
return _context39.finish(48);
|
|
4038
4053
|
case 52:
|
|
4054
|
+
return _context39.finish(49);
|
|
4055
|
+
case 53:
|
|
4039
4056
|
// 检查响应状态是否为成功状态
|
|
4040
4057
|
responseStatus = (_checkoutResponse3 = checkoutResponse) === null || _checkoutResponse3 === void 0 ? void 0 : _checkoutResponse3.status;
|
|
4041
4058
|
isSuccessResponse = responseStatus === true || responseStatus === 200 || responseStatus === 'success' || responseStatus === 1 && ((_checkoutResponse4 = checkoutResponse) === null || _checkoutResponse4 === void 0 ? void 0 : _checkoutResponse4.code) === 200;
|
|
4042
4059
|
if (isSuccessResponse) {
|
|
4043
|
-
_context39.next =
|
|
4060
|
+
_context39.next = 60;
|
|
4044
4061
|
break;
|
|
4045
4062
|
}
|
|
4046
4063
|
errorMessage = ((_checkoutResponse5 = checkoutResponse) === null || _checkoutResponse5 === void 0 ? void 0 : _checkoutResponse5.message) || '订单同步失败,后端返回非成功状态'; // 发送订单同步失败事件
|
|
4047
|
-
_context39.next =
|
|
4064
|
+
_context39.next = 59;
|
|
4048
4065
|
return this.core.effects.emit("".concat(this.name, ":onOrderSyncFailed"), {
|
|
4049
4066
|
orderUuid: this.store.currentOrder.uuid,
|
|
4050
4067
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
@@ -4055,18 +4072,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4055
4072
|
duration: Date.now() - startTime,
|
|
4056
4073
|
timestamp: Date.now()
|
|
4057
4074
|
});
|
|
4058
|
-
case 58:
|
|
4059
|
-
throw new Error(errorMessage);
|
|
4060
4075
|
case 59:
|
|
4076
|
+
throw new Error(errorMessage);
|
|
4077
|
+
case 60:
|
|
4061
4078
|
if (!isUpdateOperation) {
|
|
4062
|
-
_context39.next =
|
|
4079
|
+
_context39.next = 64;
|
|
4063
4080
|
break;
|
|
4064
4081
|
}
|
|
4065
4082
|
// 更新操作:使用现有的订单ID
|
|
4066
4083
|
realOrderId = currentOrderId;
|
|
4067
|
-
_context39.next =
|
|
4084
|
+
_context39.next = 97;
|
|
4068
4085
|
break;
|
|
4069
|
-
case
|
|
4086
|
+
case 64:
|
|
4070
4087
|
// 创建操作:从响应中提取新的订单ID
|
|
4071
4088
|
extractedOrderId = (_checkoutResponse6 = checkoutResponse) === null || _checkoutResponse6 === void 0 || (_checkoutResponse6 = _checkoutResponse6.data) === null || _checkoutResponse6 === void 0 ? void 0 : _checkoutResponse6.order_id; // 如果data.order_id不存在,尝试直接从根级获取
|
|
4072
4089
|
if (!extractedOrderId) {
|
|
@@ -4088,91 +4105,113 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4088
4105
|
oldOrderId: this.store.currentOrder.order_id,
|
|
4089
4106
|
newOrderId: realOrderId
|
|
4090
4107
|
});
|
|
4091
|
-
_context39.prev =
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4108
|
+
_context39.prev = 70;
|
|
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:
|
|
4095
4114
|
updatedOrder = _context39.sent;
|
|
4096
4115
|
this.logInfo('Payment模块替换订单ID结果:', {
|
|
4097
4116
|
wasSuccessful: !!updatedOrder,
|
|
4098
4117
|
returnedOrderId: updatedOrder === null || updatedOrder === void 0 ? void 0 : updatedOrder.order_id,
|
|
4099
4118
|
expectedOrderId: realOrderId
|
|
4100
4119
|
});
|
|
4101
|
-
if (updatedOrder) {
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
}
|
|
4110
|
-
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
|
+
});
|
|
4111
4129
|
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
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;
|
|
4120
4139
|
}
|
|
4121
|
-
_context39.next =
|
|
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;
|
|
4147
|
+
break;
|
|
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;
|
|
4122
4161
|
break;
|
|
4123
|
-
case
|
|
4124
|
-
_context39.prev =
|
|
4125
|
-
_context39.t2 = _context39["catch"](
|
|
4162
|
+
case 92:
|
|
4163
|
+
_context39.prev = 92;
|
|
4164
|
+
_context39.t2 = _context39["catch"](70);
|
|
4126
4165
|
this.logError('调用Payment模块替换订单ID时发生错误:', _context39.t2);
|
|
4127
4166
|
|
|
4128
4167
|
// 发生错误时也进行手动替换
|
|
4129
4168
|
this.store.currentOrder.order_id = realOrderId;
|
|
4130
4169
|
this.logInfo('错误恢复:手动设置订单ID:', realOrderId);
|
|
4131
|
-
case
|
|
4132
|
-
_context39.prev =
|
|
4170
|
+
case 97:
|
|
4171
|
+
_context39.prev = 97;
|
|
4133
4172
|
syncedPaymentUuids = processedPaymentItems.filter(function (item) {
|
|
4134
4173
|
return item.status !== 'voided';
|
|
4135
4174
|
}).map(function (item) {
|
|
4136
4175
|
return item.uuid;
|
|
4137
4176
|
}).filter(Boolean);
|
|
4138
4177
|
_iterator3 = _createForOfIteratorHelper(syncedPaymentUuids);
|
|
4139
|
-
_context39.prev =
|
|
4178
|
+
_context39.prev = 100;
|
|
4140
4179
|
_iterator3.s();
|
|
4141
|
-
case
|
|
4180
|
+
case 102:
|
|
4142
4181
|
if ((_step3 = _iterator3.n()).done) {
|
|
4143
|
-
_context39.next =
|
|
4182
|
+
_context39.next = 108;
|
|
4144
4183
|
break;
|
|
4145
4184
|
}
|
|
4146
4185
|
paymentUuid = _step3.value;
|
|
4147
|
-
_context39.next =
|
|
4186
|
+
_context39.next = 106;
|
|
4148
4187
|
return this.payment.updatePaymentAsync(this.store.currentOrder.uuid, paymentUuid, {
|
|
4149
4188
|
isSynced: true,
|
|
4150
4189
|
syncError: undefined
|
|
4151
4190
|
});
|
|
4152
|
-
case
|
|
4153
|
-
_context39.next =
|
|
4191
|
+
case 106:
|
|
4192
|
+
_context39.next = 102;
|
|
4154
4193
|
break;
|
|
4155
|
-
case
|
|
4156
|
-
_context39.next =
|
|
4194
|
+
case 108:
|
|
4195
|
+
_context39.next = 113;
|
|
4157
4196
|
break;
|
|
4158
|
-
case
|
|
4159
|
-
_context39.prev =
|
|
4160
|
-
_context39.t3 = _context39["catch"](
|
|
4197
|
+
case 110:
|
|
4198
|
+
_context39.prev = 110;
|
|
4199
|
+
_context39.t3 = _context39["catch"](100);
|
|
4161
4200
|
_iterator3.e(_context39.t3);
|
|
4162
|
-
case
|
|
4163
|
-
_context39.prev =
|
|
4201
|
+
case 113:
|
|
4202
|
+
_context39.prev = 113;
|
|
4164
4203
|
_iterator3.f();
|
|
4165
|
-
return _context39.finish(
|
|
4166
|
-
case
|
|
4167
|
-
_context39.next =
|
|
4204
|
+
return _context39.finish(113);
|
|
4205
|
+
case 116:
|
|
4206
|
+
_context39.next = 121;
|
|
4168
4207
|
break;
|
|
4169
|
-
case
|
|
4170
|
-
_context39.prev =
|
|
4171
|
-
_context39.t4 = _context39["catch"](
|
|
4208
|
+
case 118:
|
|
4209
|
+
_context39.prev = 118;
|
|
4210
|
+
_context39.t4 = _context39["catch"](97);
|
|
4172
4211
|
this.logWarning('标记支付项已同步失败(不阻塞主流程)', {
|
|
4173
4212
|
error: _context39.t4
|
|
4174
4213
|
});
|
|
4175
|
-
case
|
|
4214
|
+
case 121:
|
|
4176
4215
|
// 标记订单已同步
|
|
4177
4216
|
this.store.isOrderSynced = true;
|
|
4178
4217
|
|
|
@@ -4180,7 +4219,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4180
4219
|
this.clearCalculationCache();
|
|
4181
4220
|
|
|
4182
4221
|
// 触发订单同步完成事件
|
|
4183
|
-
_context39.next =
|
|
4222
|
+
_context39.next = 125;
|
|
4184
4223
|
return this.core.effects.emit("".concat(this.name, ":onOrderSynced"), {
|
|
4185
4224
|
orderUuid: this.store.currentOrder.uuid,
|
|
4186
4225
|
realOrderId: realOrderId,
|
|
@@ -4189,18 +4228,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4189
4228
|
isManual: isManual,
|
|
4190
4229
|
response: checkoutResponse
|
|
4191
4230
|
});
|
|
4192
|
-
case
|
|
4231
|
+
case 125:
|
|
4193
4232
|
return _context39.abrupt("return", {
|
|
4194
4233
|
success: true,
|
|
4195
4234
|
orderId: realOrderId,
|
|
4196
4235
|
orderUuid: this.store.currentOrder.uuid,
|
|
4197
4236
|
response: checkoutResponse
|
|
4198
4237
|
});
|
|
4199
|
-
case
|
|
4238
|
+
case 126:
|
|
4200
4239
|
case "end":
|
|
4201
4240
|
return _context39.stop();
|
|
4202
4241
|
}
|
|
4203
|
-
}, _callee39, this, [[31,
|
|
4242
|
+
}, _callee39, this, [[31, 41, 49, 53], [70, 92], [97, 118], [100, 110, 113, 116]]);
|
|
4204
4243
|
}));
|
|
4205
4244
|
function syncOrderToBackendWithReturn() {
|
|
4206
4245
|
return _syncOrderToBackendWithReturn.apply(this, arguments);
|
|
@@ -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()
|
|
@@ -2521,6 +2531,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2521
2531
|
});
|
|
2522
2532
|
checkoutResponse = await this.order.createOrderByCheckout(orderParams);
|
|
2523
2533
|
submitSuccess = true;
|
|
2534
|
+
this.store.currentOrder.payment_status = checkoutResponse.data.payment_status;
|
|
2524
2535
|
this.logInfo("下单接口调用成功", checkoutResponse);
|
|
2525
2536
|
} catch (error) {
|
|
2526
2537
|
submitSuccess = false;
|
|
@@ -2585,8 +2596,10 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2585
2596
|
newOrderId: realOrderId
|
|
2586
2597
|
});
|
|
2587
2598
|
try {
|
|
2599
|
+
const latestPaymentStatus = this.store.currentOrder.payment_status;
|
|
2600
|
+
const previousOrder = this.store.currentOrder;
|
|
2588
2601
|
const updatedOrder = await this.payment.replaceOrderIdByUuidAsync(
|
|
2589
|
-
|
|
2602
|
+
previousOrder.uuid,
|
|
2590
2603
|
realOrderId
|
|
2591
2604
|
);
|
|
2592
2605
|
this.logInfo("Payment模块替换订单ID结果:", {
|
|
@@ -2600,7 +2613,15 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2600
2613
|
orderId: updatedOrder.order_id,
|
|
2601
2614
|
totalAmount: updatedOrder.total_amount
|
|
2602
2615
|
});
|
|
2603
|
-
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
|
+
});
|
|
2604
2625
|
this.logInfo(
|
|
2605
2626
|
"[Checkout] 订单ID替换成功,当前订单ID:",
|
|
2606
2627
|
this.store.currentOrder.order_id
|