main #34

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

View File

@ -1,111 +1,22 @@
<template> <template>
<div <div class="box">
class="baidu-unsubscribe-style" <iframe src="https://console.vcp.baidu.com/billing/#/refund/list" frameborder="0" class="baidu-style"></iframe>
v-loading="loading" element-loading-text="退订处理中,请稍后···"
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)">
<iframe :src="url" v-if="flag" frameborder="0" class="baidu-style"></iframe>
</div> </div>
</template> </template>
<script> <script>
import {reqBaiduToken} from "@/api/baidu/login"; export default {
import {reqBaiduJudgePrice, reqIsReallyPeople} from "@/api/baidu";
export default {
name: "BaiduNetdiskUnsubscribe",
data() {
return {
loading: false,
url: '',
flag: false,
userid: '',
isShowWindow: true,
isAllShow: false
}
},
mounted() {
this.userid = sessionStorage.getItem('userId')
//
reqIsReallyPeople({user_id: this.userid}).then(res => {
if (!res.status) {
this.isShowWindow = true
this.isAllShow = true
this.$message.warning('您当前还没有进行实名认证,请先进行实名认证后再进行退订操作')
}
})
// token退URL
let resultUrlLast = 'https://console.vcp.baidu.com/api/loginvcp/login/securitytoken?'
reqBaiduToken({userid: this.userid}).then(res => {
if (res.status) {
this.baiduToken = res.data
// 退URL
const unsubscribeUrl = 'https://console.vcp.baidu.com/billing/#/refund/list'
resultUrlLast = resultUrlLast + '&redirectUrl=' + encodeURIComponent(unsubscribeUrl) + '&signinSecurityToken=' + encodeURIComponent(res.data)
this.url = resultUrlLast
console.log('退订页面iframeurl', resultUrlLast)
this.flag = true
} else {
this.$message.error('获取token失败')
}
})
// iframe
window.addEventListener('message', this.receiveMessage, false);
},
beforeDestroy() {
this.flag = false
window.removeEventListener('message', this.receiveMessage, false);
},
methods: {
receiveMessage(event) {
const data = event.data;
if (data && data.orderInfo && data.orderInfo.orderId) {
// 退
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)
this.loading = false
if (res.status) {
this.$message.success('退订申请提交成功')
// 退
//
} else {
this.$message.error(res.msg || '退订申请提交失败')
}
}).catch(error => {
this.loading = false
this.$message.error('退订处理失败,请稍后重试')
console.error('退订处理错误:', error)
})
}
}
} }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.baidu-unsubscribe-style { .box{
width: 100%; padding: 10px;
height: 100%;
.baidu-style { }
width: 100%; .baidu-style{
height: calc(100vh - 100px); width: 100%;
border: none; height: calc(100vh - 100px);
}
} }
</style> </style>