var w=Object.defineProperty,D=Object.defineProperties;var l=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var h=(e,a,o)=>a in e?w(e,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[a]=o,m=(e,a)=>{for(var o in a||(a={}))N.call(a,o)&&h(e,o,a[o]);if(g)for(var o of g(a))T.call(a,o)&&h(e,o,a[o]);return e},y=(e,a)=>D(e,l(a));import{m as E}from"./index.376fb8f6.js";import{r as i}from"./index.3d95a92c.js";import{o as s}from"./orderStatus.243cb96a.js";import{g as d}from"./vendor.a0144ce9.js";const b=async e=>{const a=e.goodType;let o={};switch(a){case"LIVE":try{const r=await f(e.bizId),t=[];(r.planList||[]).forEach(c=>{const n=c.startTime||new Date,p=c.endTime||new Date;t.push({courseTime:`${d(n).format("YYYY-MM-DD")} ${d(n).format("HH:mm")}~${d(p).format("HH:mm")}`,coursePlan:c.plan,id:c.courseId})}),o={orderType:e.goodType,goodName:e.goodName,courseGroupId:r.courseGroupId,courseGroupName:r.courseGroupName,coursePrice:r.coursePrice,teacherName:r.userName||`\u6E38\u5BA2${r.teacherId||""}`,teacherId:r.teacherId,avatar:r.avatar,courseInfo:t}}catch(r){throw new Error(r.message)}break;case"PRACTICE":{const r=JSON.parse(e.bizContent);o=y(m({},r),{teacherName:e.username,starGrade:e.starGrade,avatar:e.avatar});break}case"VIDEO":{try{const r=await I(e.bizId),{lessonGroup:t,detailList:u}=r;o={orderType:e.goodType,goodName:e.goodName,courseGroupId:t.id,courseGroupName:t.lessonName,coursePrice:t.lessonPrice,teacherName:t.username,teacherId:t.teacherId,avatar:t.avatar,courseInfo:u}}catch(r){throw new Error(r.message)}break}case"VIP":try{const r=await L(e.id);o={orderType:e.goodType,goodName:e.goodName,id:e.id,title:E[r.period]||"",price:r.salePrice||e.actualPrice,startTime:d(r.startTime).format("YYYY-MM-DD"),endTime:d(r.endTime).format("YYYY-MM-DD")}}catch(r){throw new Error(r.message)}break;case"MUSIC":try{const r=await P(e.bizId);o=m({orderType:e.goodType,goodName:e.goodName},r)}catch(r){throw new Error(r.message)}break}o.orderType=a,o.goodName=e.goodName,s.orderObject.orderList.push(o)},I=async e=>{try{return(await i.get("/api-student/videoLesson/selectVideoLesson",{params:{groupId:e}})).data}catch{throw new Error("\u83B7\u53D6\u89C6\u9891\u8BFE\u8BE6\u60C5\u5931\u8D25")}},f=async e=>{try{return(await i.get("/api-student/courseGroup/queryLiveCourseInfo",{params:{groupId:e}})).data}catch{throw new Error("\u83B7\u53D6\u76F4\u64AD\u8BFE\u8BE6\u60C5\u5931\u8D25")}},L=async e=>{try{return(await i.get("/api-student/vipCardRecord/detail/"+e)).data||[]}catch{throw new Error("\u83B7\u53D6\u4F1A\u5458\u8BE6\u60C5\u5931\u8D25")}},P=async e=>{try{return(await i.get(`/api-student/music/sheet/detail/${e}`)).data}catch{throw new Error("\u83B7\u53D6\u66F2\u76EE\u8BE6\u60C5\u5931\u8D25")}},B=(e,a)=>{const{orderNo:o,actualPrice:r,orderDesc:t,orderName:u,orderType:c,orderDetailList:n}=e;s.orderObject.orderType=c,s.orderObject.orderName=u,s.orderObject.orderDesc=t,s.orderObject.actualPrice=r,s.orderObject.orderNo=o,s.orderObject.orderList=[];try{n.forEach(async p=>{await b(p)}),a&&a()}catch{}};export{P as g,B as t};
