main #34

Merged
charles merged 191 commits from main into prod 2025-11-19 16:18:39 +08:00
Showing only changes of commit 1998ed5cf2 - Show all commits

View File

@ -62,22 +62,27 @@ export default {
const data = event.data;
console.log('接收到的 data 是:', data);
// 退
if (data && data.refundInfo && data.refundInfo.uuidList) {
const refundInfo = data.refundInfo.uuidList;
// ID uuidList, orderId, orderIdList
let orderId = '';
if (refundInfo.uuidList !== undefined) {
orderId = refundInfo.uuidList[0];
} else {
console.warn('未在 refundInfo 中找到有效的订单ID字段 (uuidList, orderId, orderIdList)');
this.$message.warning('退订信息不完整未找到订单ID');
return; // ID
}
// --- ---
// 1. ()
// const expectedOrigin = 'https://console.vcp.baidu.com';
// if (event.origin !== expectedOrigin) {
// console.warn('Received message from unexpected origin:', event.origin);
// return;
// }
console.log('处理后的订单ID:', orderId);
// 2. refundInfo uuidList
if (data && data.refundInfo && Array.isArray(data.refundInfo.uuidList) && data.refundInfo.uuidList.length > 0) {
const uuidListArray = data.refundInfo.uuidList; //
// ID
// 3. ID ()
// ID退
const orderId = String(uuidListArray[0]);
// ID
// const orderId = uuidListArray.join(',');
console.log('提取到的订单ID:', orderId);
// 4. ID
this.userid = sessionStorage.getItem('userId');
if (!this.userid) {
console.error('未获取到用户ID (sessionStorage 中缺少 userId)');
@ -85,20 +90,20 @@ export default {
return;
}
//
// 5.
const payload = {
order_id: orderId,
userid: this.userid
};
//
// 6.
this.loading = true;
// 退API
// 7. 退API
reqBaiduJudgePrice(payload)
.then((res) => {
console.log("调用 reqBaiduJudgePrice 接口返回:", res);
if (res.status) {
if (res.status) { // status true
this.$message.success('退订成功');
//
this.$router.push({
@ -109,13 +114,13 @@ export default {
}
});
} else {
//
this.$message.error(res.msg || '退订失败,请稍后重试');
}
})
.catch((error) => {
// ()
console.error("调用退订接口 reqBaiduJudgePrice 失败 (网络/请求错误):", error);
// error
this.$message.error('网络请求失败或服务异常,请检查网络连接后重试');
})
.finally(() => {
@ -123,7 +128,8 @@ export default {
this.loading = false;
});
} else {
console.log('接收到的消息不包含有效的退款信息');
console.log('接收到的消息不包含有效的退款信息或 uuidList 为空');
//
}
}
}
@ -138,7 +144,7 @@ export default {
.baidu-style {
width: 100%;
height: calc(100vh - 100px); // Adjust based on your layout needs
height: calc(100vh - 100px);
}
</style>