;(function(){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._video-detail_3rqhe_1 ._introduction_3rqhe_1{color:#7a7a7a;line-height:.61333rem;padding-bottom:.21333rem}._video-detail_3rqhe_1 ._btnGroup_3rqhe_6{padding:0 .37333rem .4rem}._video-detail_3rqhe_1 ._btnMore_3rqhe_10{display:flex;justify-content:space-around}._video-detail_3rqhe_1 ._btnMore_3rqhe_10 .van-button{width:55%}\n";document.head.appendChild(__vite_style__);System.register(['./index-legacy.f664b9ab.js','./index-legacy.f15c7f1b.js','./index-legacy.11707c5f.js','./vendor-legacy.b3aeff6a.js','./index-legacy.f25f109a3.js','./index-legacy.101dd5f6.js','./index-legacy.9cbfcbc2.js','./orderStatus-legacy.9807dd89.js','./tradeOrder-legacy.e5a61043.js','./index-legacy.f25f109a.js','./index-legacy.f25f109a2.js','./bars-legacy.9085ff9b.js','./index-legacy.f25f109a4.js','./icon_teacher-legacy.e765b7f7.js','./icon_timer2-legacy.b6c78faa.js','./icon-jiaozi-legacy.dd5ed0e2.js','./index-legacy.f25f109a8.js','./index-legacy.9dfebfce.js'],function(exports){'use strict';var CourseVideoItem,SectionDetail,UserDetail,defineComponent,Dialog,createVNode,isVNode,Sticky,Button,request,ColHeader,orderStatus,onSubmitZero,tradeOrder;return{setters:[function(module){CourseVideoItem=module.C;},function(module){SectionDetail=module.S;},function(module){UserDetail=module.U;},function(module){defineComponent=module.d;Dialog=module.D;createVNode=module.a;isVNode=module.x;Sticky=module.S;Button=module.B;},function(){},function(module){request=module.r;},function(module){ColHeader=module.C;},function(module){orderStatus=module.o;onSubmitZero=module.a;},function(module){tradeOrder=module.t;},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function execute(){var introduction="_introduction_3rqhe_1";var btnGroup="_btnGroup_3rqhe_6";var btnMore="_btnMore_3rqhe_10";var styles={"video-detail":"_video-detail_3rqhe_1",introduction:introduction,btnGroup:btnGroup,btnMore:btnMore};function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var videoDetail=exports('default',defineComponent({name:'VideoDetail',data:function data(){var query=this.$route.query;return{userInfo:{},detailList:[],recomUserId:query.recomUserId,// 推荐人id
params:{groupId:query.groupId}};},mounted:function mounted(){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _this._init();case 2:case"end":return _context.stop();}}},_callee);}))();},methods:{_init:function _init(){var _this2=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var res,result,lessonGroup,teachertTag;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return request.get('/api-student/videoLesson/selectVideoLesson',{params:{groupId:_this2.params.groupId}});case 3:res=_context2.sent;result=res.data||{};lessonGroup=result.lessonGroup||{};teachertTag=result.teachertTag||'';_this2.userInfo={alreadyBuy:result.alreadyBuy,username:lessonGroup.username||"\u6E38\u5BA2".concat(lessonGroup.teacherId||''),headUrl:lessonGroup.avatar,buyNum:lessonGroup.countStudent,id:lessonGroup.id,lessonNum:lessonGroup.lessonCount,lessonName:lessonGroup.lessonName,lessonDesc:lessonGroup.lessonDesc,lessonPrice:lessonGroup.lessonPrice,teacherId:lessonGroup.teacherId,lessonCoverUrl:lessonGroup.lessonCoverUrl,auditVersion:lessonGroup.auditVersion,isDegree:result.degreeFlag?true:false,isTeacher:result.teacherFlag?true:false};_this2.detailList=result.detailList||[];_context2.next=13;break;case 11:_context2.prev=11;_context2.t0=_context2["catch"](0);case 13:case"end":return _context2.stop();}}},_callee2,null,[[0,11]]);}))();},onPlay:function onPlay(detail){this.$router.push({path:'/videoClassDetail',query:{groupId:this.params.groupId,classId:detail.id}});},onBuy:function onBuy(){var _this3=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee4(){var userInfo,res,result;return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.prev=0;userInfo=_this3.userInfo;orderStatus.orderObject.orderType='VIDEO';orderStatus.orderObject.orderName='视频课购买';orderStatus.orderObject.orderDesc='视频课购买';orderStatus.orderObject.actualPrice=userInfo.lessonPrice;orderStatus.orderObject.recomUserId=_this3.recomUserId;orderStatus.orderObject.orderNo='';orderStatus.orderObject.orderList=[{orderType:'VIDEO',goodsName:'视频课购买',courseGroupId:userInfo.id,courseGroupName:userInfo.lessonName,coursePrice:userInfo.lessonPrice,teacherName:userInfo.username||"\u6E38\u5BA2".concat(userInfo.teacherId||''),teacherId:userInfo.teacherId,avatar:userInfo.headUrl,courseInfo:_this3.detailList,recomUserId:_this3.recomUserId}];// 判断是否是0无订单
if(!(userInfo.lessonPrice<=0)){_context4.next=13;break;}_context4.next=12;return onSubmitZero(function(){Dialog.alert({message:'领取成功',confirmButtonText:'确定',confirmButtonColor:'#2dc7aa'}).then(function(){_this3._init();});});case 12:return _context4.abrupt("return");case 13:_context4.next=15;return request.post('/api-student/userOrder/getPendingOrder',{data:{goodType:'VIDEO',bizId:_this3.params.groupId}});case 15:res=_context4.sent;result=res.data;if(result){Dialog.confirm({title:'提示',message:'您有一个未支付的订单，是否继续支付？',confirmButtonColor:'#269a93',cancelButtonText:'取消订单',confirmButtonText:'继续支付'}).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:tradeOrder(result,_this3.routerTo);case 1:case"end":return _context3.stop();}}},_callee3);}))).catch(function(){Dialog.close();// 只用取消订单，不用做其它处理
_this3.cancelPayment(result.orderNo);});}else{_this3.routerTo();}_context4.next=22;break;case 20:_context4.prev=20;_context4.t0=_context4["catch"](0);case 22:case"end":return _context4.stop();}}},_callee4,null,[[0,20]]);}))();},routerTo:function routerTo(){this.$router.push({path:'/orderDetail',query:{orderType:'VIDEO',courseGroupId:this.params.groupId}});},cancelPayment:function cancelPayment(orderNo){return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee5(){return regeneratorRuntime.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:_context5.prev=0;_context5.next=3;return request.post('/api-student/userOrder/orderCancel',{data:{orderNo:orderNo}});case 3:_context5.next=7;break;case 5:_context5.prev=5;_context5.t0=_context5["catch"](0);case 7:case"end":return _context5.stop();}}},_callee5,null,[[0,5]]);}))();}},render:function render(){var _this4=this;var _slot;return createVNode("div",{"class":[styles['video-detail']]},[createVNode(ColHeader,null,null),createVNode(UserDetail,{"userInfo":this.userInfo},null),createVNode(SectionDetail,null,{default:function _default(){return[createVNode("p",{"class":styles.introduction},[_this4.userInfo.lessonDesc])];}}),createVNode(SectionDetail,{"title":"课程列表","icon":"courseList","class":"mb12"},_isSlot(_slot=this.detailList.map(function(item){return createVNode(CourseVideoItem,{"class":'mb12',"detail":{id:item.id,title:item.videoTitle,content:item.videoContent,imgUrl:item.coverUrl},"onPlay":_this4.onPlay},null);}))?_slot:{default:function _default(){return[_slot];}}),this.userInfo.id&&!this.userInfo.alreadyBuy&&createVNode(Sticky,{"offsetBottom":0,"position":"bottom"},{default:function _default(){return[createVNode("div",{"class":['btnGroup',styles.btnMore]},[createVNode(Button,{"block":true,"round":true,"type":"primary","onClick":_this4.onBuy},{default:function _default(){return[_this4.userInfo.lessonPrice<=0?'免费领取':"\u7ACB\u5373\u8D2D\u4E70"];}})])];}})]);}}));}};});})();
