1 |
- var E=Object.defineProperty,b=Object.defineProperties;var N=Object.getOwnPropertyDescriptors;var g=Object.getOwnPropertySymbols;var l=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var w=(e,o,a)=>o in e?E(e,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[o]=a,h=(e,o)=>{for(var a in o||(o={}))l.call(o,a)&&w(e,a,o[a]);if(g)for(var a of g(o))I.call(o,a)&&w(e,a,o[a]);return e},T=(e,o)=>b(e,N(o));import{m as f}from"./index.c593ab77.js";import{s as P,r as u}from"./index.b8b9219f.js";import{o as c}from"./orderStatus.c1cbd21b.js";import{h as n}from"./vendor.2bcdc9cf.js";const i=P.platformType==="STUDENT"?"/api-student":"/api-teacher",v=async(e,o)=>{const a=e.goodType;let t={};switch(a){case"LIVE":try{const r=await j(e.bizId),s=[];(r.planList||[]).forEach(d=>{const y=d.startTime||new Date,m=d.endTime||new Date;s.push({courseTime:`${n(y).format("YYYY-MM-DD")} ${n(y).format("HH:mm")}~${n(m).format("HH:mm")}`,coursePlan:d.plan,id:d.courseId})}),t={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:s}}catch(r){throw new Error(r.message)}break;case"PRACTICE":{const r=JSON.parse(e.bizContent);t=T(h({},r),{teacherName:e.username,starGrade:e.starGrade,avatar:e.avatar});break}case"VIDEO":{try{const r=await C(e.bizId),{lessonGroup:s,detailList:p}=r;t={orderType:e.goodType,goodName:e.goodName,courseGroupId:s.id,courseGroupName:s.lessonName,coursePrice:s.lessonPrice,teacherName:s.username,teacherId:s.teacherId,avatar:s.avatar,courseInfo:p}}catch(r){throw new Error(r.message)}break}case"VIP":try{const r=await L(e.id);t={orderType:e.goodType,goodName:e.goodName,id:e.id,title:f[r.period]||"",price:(o==null?void 0:o.couponAmount)?Number((r.salePrice-o.couponAmount+o.discountPrice).toFixed(2)):r.salePrice||e.actualPrice,startTime:n(r.startTime).format("YYYY-MM-DD"),endTime:n(r.endTime).format("YYYY-MM-DD")}}catch(r){throw new Error(r.message)}break;case"MUSIC":try{const r=await B(e.bizId);t=h({orderType:e.goodType,goodName:e.goodName},r)}catch(r){throw new Error(r.message)}break;case"ACTI_REGIST":try{const r=await O(e.bizId);t={orderType:e.goodType,goodsName:r.activityName,activityId:r.id,actualPrice:r.registrationPrice}}catch(r){throw new Error(r.message)}break}t.orderType=a,t.goodName=e.goodName,c.orderObject.orderList.push(t)},C=async e=>{try{return(await u.get(`${i}/videoLesson/selectVideoLesson`,{params:{groupId:e}})).data}catch{throw new Error("\u83B7\u53D6\u89C6\u9891\u8BFE\u8BE6\u60C5\u5931\u8D25")}},j=async e=>{try{return(await u.get(`${i}/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 u.get(`${i}/vipCardRecord/detail/`+e)).data||[]}catch{throw new Error("\u83B7\u53D6\u4F1A\u5458\u8BE6\u60C5\u5931\u8D25")}},B=async e=>{try{return(await u.get(`${i}/music/sheet/detail/${e}`)).data}catch{throw new Error("\u83B7\u53D6\u66F2\u76EE\u8BE6\u60C5\u5931\u8D25")}},O=async e=>{try{return(await u.post(`${i}/open/activity/info/${e}`)).data}catch{throw new Error("\u83B7\u53D6\u66F2\u76EE\u8BE6\u60C5\u5931\u8D25")}},F=(e,o)=>{const{orderNo:a,actualPrice:t,orderDesc:r,orderName:s,orderType:p,orderDetailList:d,couponAmount:y,discountPrice:m}=e;c.orderObject.orderType=p,c.orderObject.orderName=s,c.orderObject.orderDesc=r,c.orderObject.actualPrice=t,c.orderObject.orderNo=a,c.orderObject.discountPrice=m,c.orderObject.orderList=[];try{d.forEach(async D=>{await v(D,{couponAmount:y,discountPrice:m})}),o&&o()}catch{}};export{B as g,F as t};
|