import{C as u}from"./index.e66cb6b0.js";import{S as n}from"./index.f4e1cfd8.js";import{U as c}from"./index.b5a9ab3d.js";import{d as l,D as d,a as o,x as p,S as m,B as h,j as f}from"./vendor.a0144ce9.js";/* empty css               */import{r as a}from"./index.3d95a92c.js";import{C as y}from"./index.fc7d34d1.js";import{o as s}from"./orderStatus.243cb96a.js";import{t as I}from"./tradeOrder.9ddf20ea.js";/* empty css               *//* empty css               */import"./bars.4f1962a6.js";/* empty css              *//* empty css                */import"./icon_teacher.40b6f077.js";import"./icon_timer2.563d016a.js";/* empty css               */import"./index.376fb8f6.js";const b="_introduction_3rqhe_1",j="_btnGroup_3rqhe_6",v="_btnMore_3rqhe_10";var i={"video-detail":"_video-detail_3rqhe_1",introduction:b,btnGroup:j,btnMore:v};function D(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!p(t)}var k=l({name:"VideoDetail",data(){const t=this.$route.query;return{userInfo:{},detailList:[],params:{groupId:t.groupId}}},async mounted(){try{const e=(await a.get("/api-student/videoLesson/selectVideoLesson",{params:{groupId:this.params.groupId}})).data||{},r=e.lessonGroup||{};this.userInfo={alreadyBuy:e.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},this.detailList=e.detailList||[]}catch{}},methods:{onPlay(t){this.$router.push({path:"/videoClassDetail",query:{groupId:this.params.groupId,classId:t.id}})},async onBuy(){try{const t=await a.post("/api-student/userOrder/getPendingOrder",{data:{goodType:"VIDEO",bizId:this.params.groupId}}),e=this.userInfo;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.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}];const r=t.data;r?d.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()=>{I(r,this.routerTo)}).catch(()=>{d.close(),this.cancelPayment(r.orderNo)}):this.routerTo()}catch{}},routerTo(){this.$router.push({path:"/orderDetail",query:{orderType:"VIDEO",courseGroupId:this.params.groupId}})},async cancelPayment(t){try{await a.post("/api-student/userOrder/orderCancel",{data:{orderNo:t}})}catch{}}},render(){let t;return o("div",{class:[i["video-detail"]]},[o(y,null,null),o(c,{userInfo:this.userInfo},null),o(n,null,{default:()=>[o("p",{class:i.introduction},[this.userInfo.lessonDesc])]}),o(n,{title:"\u8BFE\u7A0B\u5217\u8868",icon:"courseList",class:"mb12"},D(t=this.detailList.map(e=>o(u,{class:"mb12",detail:{id:e.id,title:e.videoTitle,content:e.videoContent,imgUrl:e.coverUrl},onPlay:this.onPlay},null)))?t:{default:()=>[t]}),this.userInfo.id&&!this.userInfo.alreadyBuy&&o(m,{offsetBottom:0,position:"bottom"},{default:()=>[o("div",{class:["btnGroup",i.btnMore]},[o(h,{block:!0,round:!0,type:"primary",onClick:this.onBuy},{default:()=>[f("\u7ACB\u5373\u8D2D\u4E70")]})])]})])}});export{k as default};
