@pisell/pisellos 0.0.408 → 0.0.409
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.
|
@@ -3997,18 +3997,19 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3997
3997
|
case 35:
|
|
3998
3998
|
checkoutResponse = _context39.sent;
|
|
3999
3999
|
submitSuccess = true;
|
|
4000
|
+
this.store.currentOrder.payment_status = checkoutResponse.data.payment_status;
|
|
4000
4001
|
this.logInfo('下单接口调用成功', checkoutResponse);
|
|
4001
|
-
_context39.next =
|
|
4002
|
+
_context39.next = 49;
|
|
4002
4003
|
break;
|
|
4003
|
-
case
|
|
4004
|
-
_context39.prev =
|
|
4004
|
+
case 41:
|
|
4005
|
+
_context39.prev = 41;
|
|
4005
4006
|
_context39.t1 = _context39["catch"](31);
|
|
4006
4007
|
submitSuccess = false;
|
|
4007
4008
|
submitError = _context39.t1 instanceof Error ? _context39.t1.message : String(_context39.t1);
|
|
4008
4009
|
this.logError('下单接口调用失败:', submitError);
|
|
4009
4010
|
|
|
4010
4011
|
// 发送订单同步失败事件(网络错误或请求失败)
|
|
4011
|
-
_context39.next =
|
|
4012
|
+
_context39.next = 48;
|
|
4012
4013
|
return this.core.effects.emit("".concat(this.name, ":onOrderSyncFailed"), {
|
|
4013
4014
|
orderUuid: this.store.currentOrder.uuid,
|
|
4014
4015
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
@@ -4018,11 +4019,11 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4018
4019
|
duration: Date.now() - startTime,
|
|
4019
4020
|
timestamp: Date.now()
|
|
4020
4021
|
});
|
|
4021
|
-
case 47:
|
|
4022
|
-
throw _context39.t1;
|
|
4023
4022
|
case 48:
|
|
4024
|
-
_context39.
|
|
4025
|
-
|
|
4023
|
+
throw _context39.t1;
|
|
4024
|
+
case 49:
|
|
4025
|
+
_context39.prev = 49;
|
|
4026
|
+
_context39.next = 52;
|
|
4026
4027
|
return this.core.effects.emit("".concat(this.name, ":onOrderSubmitEnd"), {
|
|
4027
4028
|
success: submitSuccess,
|
|
4028
4029
|
orderUuid: this.store.currentOrder.uuid,
|
|
@@ -4033,18 +4034,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4033
4034
|
duration: Date.now() - startTime,
|
|
4034
4035
|
timestamp: Date.now()
|
|
4035
4036
|
});
|
|
4036
|
-
case 51:
|
|
4037
|
-
return _context39.finish(48);
|
|
4038
4037
|
case 52:
|
|
4038
|
+
return _context39.finish(49);
|
|
4039
|
+
case 53:
|
|
4039
4040
|
// 检查响应状态是否为成功状态
|
|
4040
4041
|
responseStatus = (_checkoutResponse3 = checkoutResponse) === null || _checkoutResponse3 === void 0 ? void 0 : _checkoutResponse3.status;
|
|
4041
4042
|
isSuccessResponse = responseStatus === true || responseStatus === 200 || responseStatus === 'success' || responseStatus === 1 && ((_checkoutResponse4 = checkoutResponse) === null || _checkoutResponse4 === void 0 ? void 0 : _checkoutResponse4.code) === 200;
|
|
4042
4043
|
if (isSuccessResponse) {
|
|
4043
|
-
_context39.next =
|
|
4044
|
+
_context39.next = 60;
|
|
4044
4045
|
break;
|
|
4045
4046
|
}
|
|
4046
4047
|
errorMessage = ((_checkoutResponse5 = checkoutResponse) === null || _checkoutResponse5 === void 0 ? void 0 : _checkoutResponse5.message) || '订单同步失败,后端返回非成功状态'; // 发送订单同步失败事件
|
|
4047
|
-
_context39.next =
|
|
4048
|
+
_context39.next = 59;
|
|
4048
4049
|
return this.core.effects.emit("".concat(this.name, ":onOrderSyncFailed"), {
|
|
4049
4050
|
orderUuid: this.store.currentOrder.uuid,
|
|
4050
4051
|
operation: isUpdateOperation ? 'update' : 'create',
|
|
@@ -4055,18 +4056,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4055
4056
|
duration: Date.now() - startTime,
|
|
4056
4057
|
timestamp: Date.now()
|
|
4057
4058
|
});
|
|
4058
|
-
case 58:
|
|
4059
|
-
throw new Error(errorMessage);
|
|
4060
4059
|
case 59:
|
|
4060
|
+
throw new Error(errorMessage);
|
|
4061
|
+
case 60:
|
|
4061
4062
|
if (!isUpdateOperation) {
|
|
4062
|
-
_context39.next =
|
|
4063
|
+
_context39.next = 64;
|
|
4063
4064
|
break;
|
|
4064
4065
|
}
|
|
4065
4066
|
// 更新操作:使用现有的订单ID
|
|
4066
4067
|
realOrderId = currentOrderId;
|
|
4067
|
-
_context39.next =
|
|
4068
|
+
_context39.next = 83;
|
|
4068
4069
|
break;
|
|
4069
|
-
case
|
|
4070
|
+
case 64:
|
|
4070
4071
|
// 创建操作:从响应中提取新的订单ID
|
|
4071
4072
|
extractedOrderId = (_checkoutResponse6 = checkoutResponse) === null || _checkoutResponse6 === void 0 || (_checkoutResponse6 = _checkoutResponse6.data) === null || _checkoutResponse6 === void 0 ? void 0 : _checkoutResponse6.order_id; // 如果data.order_id不存在,尝试直接从根级获取
|
|
4072
4073
|
if (!extractedOrderId) {
|
|
@@ -4088,10 +4089,10 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4088
4089
|
oldOrderId: this.store.currentOrder.order_id,
|
|
4089
4090
|
newOrderId: realOrderId
|
|
4090
4091
|
});
|
|
4091
|
-
_context39.prev =
|
|
4092
|
-
_context39.next =
|
|
4092
|
+
_context39.prev = 70;
|
|
4093
|
+
_context39.next = 73;
|
|
4093
4094
|
return this.payment.replaceOrderIdByUuidAsync(this.store.currentOrder.uuid, realOrderId);
|
|
4094
|
-
case
|
|
4095
|
+
case 73:
|
|
4095
4096
|
updatedOrder = _context39.sent;
|
|
4096
4097
|
this.logInfo('Payment模块替换订单ID结果:', {
|
|
4097
4098
|
wasSuccessful: !!updatedOrder,
|
|
@@ -4118,61 +4119,61 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4118
4119
|
目标ID: realOrderId
|
|
4119
4120
|
});
|
|
4120
4121
|
}
|
|
4121
|
-
_context39.next =
|
|
4122
|
+
_context39.next = 83;
|
|
4122
4123
|
break;
|
|
4123
|
-
case
|
|
4124
|
-
_context39.prev =
|
|
4125
|
-
_context39.t2 = _context39["catch"](
|
|
4124
|
+
case 78:
|
|
4125
|
+
_context39.prev = 78;
|
|
4126
|
+
_context39.t2 = _context39["catch"](70);
|
|
4126
4127
|
this.logError('调用Payment模块替换订单ID时发生错误:', _context39.t2);
|
|
4127
4128
|
|
|
4128
4129
|
// 发生错误时也进行手动替换
|
|
4129
4130
|
this.store.currentOrder.order_id = realOrderId;
|
|
4130
4131
|
this.logInfo('错误恢复:手动设置订单ID:', realOrderId);
|
|
4131
|
-
case
|
|
4132
|
-
_context39.prev =
|
|
4132
|
+
case 83:
|
|
4133
|
+
_context39.prev = 83;
|
|
4133
4134
|
syncedPaymentUuids = processedPaymentItems.filter(function (item) {
|
|
4134
4135
|
return item.status !== 'voided';
|
|
4135
4136
|
}).map(function (item) {
|
|
4136
4137
|
return item.uuid;
|
|
4137
4138
|
}).filter(Boolean);
|
|
4138
4139
|
_iterator3 = _createForOfIteratorHelper(syncedPaymentUuids);
|
|
4139
|
-
_context39.prev =
|
|
4140
|
+
_context39.prev = 86;
|
|
4140
4141
|
_iterator3.s();
|
|
4141
|
-
case
|
|
4142
|
+
case 88:
|
|
4142
4143
|
if ((_step3 = _iterator3.n()).done) {
|
|
4143
|
-
_context39.next =
|
|
4144
|
+
_context39.next = 94;
|
|
4144
4145
|
break;
|
|
4145
4146
|
}
|
|
4146
4147
|
paymentUuid = _step3.value;
|
|
4147
|
-
_context39.next =
|
|
4148
|
+
_context39.next = 92;
|
|
4148
4149
|
return this.payment.updatePaymentAsync(this.store.currentOrder.uuid, paymentUuid, {
|
|
4149
4150
|
isSynced: true,
|
|
4150
4151
|
syncError: undefined
|
|
4151
4152
|
});
|
|
4152
|
-
case
|
|
4153
|
-
_context39.next =
|
|
4153
|
+
case 92:
|
|
4154
|
+
_context39.next = 88;
|
|
4154
4155
|
break;
|
|
4155
|
-
case
|
|
4156
|
-
_context39.next =
|
|
4156
|
+
case 94:
|
|
4157
|
+
_context39.next = 99;
|
|
4157
4158
|
break;
|
|
4158
|
-
case
|
|
4159
|
-
_context39.prev =
|
|
4160
|
-
_context39.t3 = _context39["catch"](
|
|
4159
|
+
case 96:
|
|
4160
|
+
_context39.prev = 96;
|
|
4161
|
+
_context39.t3 = _context39["catch"](86);
|
|
4161
4162
|
_iterator3.e(_context39.t3);
|
|
4162
|
-
case
|
|
4163
|
-
_context39.prev =
|
|
4163
|
+
case 99:
|
|
4164
|
+
_context39.prev = 99;
|
|
4164
4165
|
_iterator3.f();
|
|
4165
|
-
return _context39.finish(
|
|
4166
|
-
case
|
|
4167
|
-
_context39.next =
|
|
4166
|
+
return _context39.finish(99);
|
|
4167
|
+
case 102:
|
|
4168
|
+
_context39.next = 107;
|
|
4168
4169
|
break;
|
|
4169
|
-
case
|
|
4170
|
-
_context39.prev =
|
|
4171
|
-
_context39.t4 = _context39["catch"](
|
|
4170
|
+
case 104:
|
|
4171
|
+
_context39.prev = 104;
|
|
4172
|
+
_context39.t4 = _context39["catch"](83);
|
|
4172
4173
|
this.logWarning('标记支付项已同步失败(不阻塞主流程)', {
|
|
4173
4174
|
error: _context39.t4
|
|
4174
4175
|
});
|
|
4175
|
-
case
|
|
4176
|
+
case 107:
|
|
4176
4177
|
// 标记订单已同步
|
|
4177
4178
|
this.store.isOrderSynced = true;
|
|
4178
4179
|
|
|
@@ -4180,7 +4181,7 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4180
4181
|
this.clearCalculationCache();
|
|
4181
4182
|
|
|
4182
4183
|
// 触发订单同步完成事件
|
|
4183
|
-
_context39.next =
|
|
4184
|
+
_context39.next = 111;
|
|
4184
4185
|
return this.core.effects.emit("".concat(this.name, ":onOrderSynced"), {
|
|
4185
4186
|
orderUuid: this.store.currentOrder.uuid,
|
|
4186
4187
|
realOrderId: realOrderId,
|
|
@@ -4189,18 +4190,18 @@ export var CheckoutImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
4189
4190
|
isManual: isManual,
|
|
4190
4191
|
response: checkoutResponse
|
|
4191
4192
|
});
|
|
4192
|
-
case
|
|
4193
|
+
case 111:
|
|
4193
4194
|
return _context39.abrupt("return", {
|
|
4194
4195
|
success: true,
|
|
4195
4196
|
orderId: realOrderId,
|
|
4196
4197
|
orderUuid: this.store.currentOrder.uuid,
|
|
4197
4198
|
response: checkoutResponse
|
|
4198
4199
|
});
|
|
4199
|
-
case
|
|
4200
|
+
case 112:
|
|
4200
4201
|
case "end":
|
|
4201
4202
|
return _context39.stop();
|
|
4202
4203
|
}
|
|
4203
|
-
}, _callee39, this, [[31,
|
|
4204
|
+
}, _callee39, this, [[31, 41, 49, 53], [70, 78], [83, 104], [86, 96, 99, 102]]);
|
|
4204
4205
|
}));
|
|
4205
4206
|
function syncOrderToBackendWithReturn() {
|
|
4206
4207
|
return _syncOrderToBackendWithReturn.apply(this, arguments);
|
|
@@ -2521,6 +2521,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
2521
2521
|
});
|
|
2522
2522
|
checkoutResponse = await this.order.createOrderByCheckout(orderParams);
|
|
2523
2523
|
submitSuccess = true;
|
|
2524
|
+
this.store.currentOrder.payment_status = checkoutResponse.data.payment_status;
|
|
2524
2525
|
this.logInfo("下单接口调用成功", checkoutResponse);
|
|
2525
2526
|
} catch (error) {
|
|
2526
2527
|
submitSuccess = false;
|