import{C as c}from"./index.853940fc.js";import{S as d}from"./index.292571c9.js";import{U as u}from"./index.eeabc16f.js";import{d as l,D as a,a as o,x as m,S as p,B as h}from"./vendor.cd162bf7.js";/* empty css               */import{r as i}from"./index.a9c80450.js";import{C as f}from"./index.d3c070ae.js";import{o as s,a as I}from"./orderStatus.86d72629.js";import{t as y}from"./tradeOrder.a2082e5c.js";/* empty css              *//* empty css               */import"./bars.4f1962a6.js";/* empty css               */import"./icon_teacher.cb128c00.js";import"./icon_timer2.5fb1750d.js";import"./icon-jiaozi.20e415ca.js";/* empty css               */import"./index.aec0a459.js";const b="_introduction_3rqhe_1",j="_btnGroup_3rqhe_6",g="_btnMore_3rqhe_10";var n={"video-detail":"_video-detail_3rqhe_1",introduction:b,btnGroup:j,btnMore:g};function _(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!m(e)}var k=l({name:"VideoDetail",data(){const e=this.$route.query;return{userInfo:{},detailList:[],recomUserId:e.recomUserId,params:{groupId:e.groupId}}},async mounted(){await this._init()},methods:{async _init(){try{const t=(await i.get("/api-student/videoLesson/selectVideoLesson",{params:{groupId:this.params.groupId}})).data||{},r=t.lessonGroup||{},v=t.teachertTag||"";this.userInfo={alreadyBuy:t.alreadyBuy,username:r.username||`\u6E38\u5BA2${r.teacherId||""}`,headUrl:r.avatar,buyNum:r.countStudent,id:r.id,lessonNum:r.lessonCount,lessonName:r.lessonName,lessonDesc:r.lessonDesc,lessonPrice:r.lessonPrice,teacherId:r.teacherId,lessonCoverUrl:r.lessonCoverUrl,auditVersion:r.auditVersion,isDegree:!!t.degreeFlag,isTeacher:!!t.teacherFlag},this.detailList=t.detailList||[]}catch{}},onPlay(e){this.$router.push({path:"/videoClassDetail",query:{groupId:this.params.groupId,classId:e.id}})},async onBuy(){try{const e=this.userInfo;if(s.orderObject.orderType="VIDEO",s.orderObject.orderName="\u89C6\u9891\u8BFE\u8D2D\u4E70",s.orderObject.orderDesc="\u89C6\u9891\u8BFE\u8D2D\u4E70",s.orderObject.actualPrice=e.lessonPrice,s.orderObject.recomUserId=this.recomUserId,s.orderObject.orderNo="",s.orderObject.orderList=[{orderType:"VIDEO",goodsName:"\u89C6\u9891\u8BFE\u8D2D\u4E70",courseGroupId:e.id,courseGroupName:e.lessonName,coursePrice:e.lessonPrice,teacherName:e.username||`\u6E38\u5BA2${e.teacherId||""}`,teacherId:e.teacherId,avatar:e.headUrl,courseInfo:this.detailList,recomUserId:this.recomUserId}],e.lessonPrice<=0){await I(()=>{a.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}).then(()=>{this._init()})});return}const r=(await i.post("/api-student/userOrder/getPendingOrder",{data:{goodType:"VIDEO",bizId:this.params.groupId}})).data;r?a.confirm({title:"\u63D0\u793A",message:"\u60A8\u6709\u4E00\u4E2A\u672A\u652F\u4ED8\u7684\u8BA2\u5355\uFF0C\u662F\u5426\u7EE7\u7EED\u652F\u4ED8\uFF1F",confirmButtonColor:"#269a93",cancelButtonText:"\u53D6\u6D88\u8BA2\u5355",confirmButtonText:"\u7EE7\u7EED\u652F\u4ED8"}).then(async()=>{y(r,this.routerTo)}).catch(()=>{a.close(),this.cancelPayment(r.orderNo)}):this.routerTo()}catch{}},routerTo(){this.$router.push({path:"/orderDetail",query:{orderType:"VIDEO",courseGroupId:this.params.groupId}})},async cancelPayment(e){try{await i.post("/api-student/userOrder/orderCancel",{data:{orderNo:e}})}catch{}}},render(){let e;return o("div",{class:[n["video-detail"]]},[o(f,null,null),o(u,{userInfo:this.userInfo},null),o(d,null,{default:()=>[o("p",{class:n.introduction},[this.userInfo.lessonDesc])]}),o(d,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",class:"mb12"},_(e=this.detailList.map(t=>o(c,{class:"mb12",detail:{id:t.id,title:t.videoTitle,content:t.videoContent,imgUrl:t.coverUrl},onPlay:this.onPlay},null)))?e:{default:()=>[e]}),this.userInfo.id&&!this.userInfo.alreadyBuy&&o(p,{offsetBottom:0,position:"bottom"},{default:()=>[o("div",{class:["btnGroup",n.btnMore]},[o(h,{block:!0,round:!0,type:"primary",onClick:this.onBuy},{default:()=>[this.userInfo.lessonPrice<=0?"\u514D\u8D39\u9886\u53D6":"\u7ACB\u5373\u8D2D\u4E70"]})])]})])}});export{k as default};
