main #34
@ -23,13 +23,16 @@ export default {
|
||||
return {
|
||||
userToken: '',
|
||||
url: '',
|
||||
loading: true
|
||||
loading: true,
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.getToken();
|
||||
},
|
||||
methods: {
|
||||
// 点击退订返回个信息 拿着信息请求 百度回调
|
||||
// 获取百度云token
|
||||
// this.userid = sessionStorage.getItem('userId')
|
||||
async getToken() {
|
||||
try {
|
||||
this.loading = true;
|
||||
@ -48,6 +51,47 @@ export default {
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
receiveMessage(event) {
|
||||
// if (event.origin !== "https://example.com") {
|
||||
// // 确保消息来自预期的源
|
||||
// return;
|
||||
// }
|
||||
// console.log("iframe中的event是", event);
|
||||
const data = event.data;
|
||||
if (data && data.orderInfo && data.orderInfo.orderId) {
|
||||
// 检查接收到的数据是否包含 orderId 或者 orderIdList
|
||||
this.loading = true
|
||||
|
||||
const orderId = data.orderInfo.orderId
|
||||
console.log('接收到订单ID:', orderId);
|
||||
let ploay = {
|
||||
order_id: orderId,
|
||||
userid: this.userid
|
||||
}
|
||||
reqBaiduJudgePrice(ploay).then((res) => {
|
||||
console.log("二级接口是", res)
|
||||
if (res.status) {
|
||||
// let lastPloay = {
|
||||
// orderid: res.orderid,
|
||||
// product_url: this.$route.params.listUrl ? this.$route.params.listUrl : localStorage.getItem('userRescourseUrl')
|
||||
// }
|
||||
this.$router.push({
|
||||
name: 'userResource',
|
||||
params: {
|
||||
listUrl: this.$route.params.listUrl,
|
||||
url: this.$route.params.url
|
||||
}
|
||||
})
|
||||
this.$message.success('退订成功')
|
||||
} else {
|
||||
this.loading = false
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
// 在这里处理接收到的订单ID
|
||||
const orderLog = data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user