orderStatus.020f67a3.js 2.1 KB

1
  1. import{S as i,s as a,e as l,D as c}from"./index.7994470a.js";const n=()=>({orderType:"",orderInfo:{orderNo:"",actualPrice:0,payStatus:!0},orderObject:{orderNo:"",actualPrice:0,orderName:"",orderDesc:"",orderType:"",recomUserId:null,orderList:[],activityId:"",couponId:"",discountPrice:0}}),u=i(n()),T=()=>{Object.assign(u,n())},p=()=>(u.orderObject.orderList||[]).map(e=>{const r={goodType:e.orderType,goodName:e.goodsName,recomUserId:e.recomUserId,bizContent:{}};if(e.orderType==="VIDEO")r.bizContent={videoLessonGroupId:e.courseGroupId,payMoney:e.coursePrice||0};else if(e.orderType==="LIVE")r.bizContent={groupId:e.courseGroupId};else if(e.orderType==="PRACTICE"){const d=e.classTime||[],o=[];d.forEach(t=>{o.push({classDate:t.classDate,startTime:t.startTime,endTime:t.endTime})}),r.bizContent={courseGroupName:e.courseGroupName,courseIntroduce:e.courseIntroduce,subjectId:e.subjectId,singleCourseMinutes:e.singleCourseMinutes,courseNum:e.courseNum,coursePrice:e.coursePrice,teacherId:e.teacherId,classTime:o}}else e.orderType==="VIP"?r.bizContent=e.id:e.orderType==="MUSIC"?r.bizContent={musicSheetId:e.id,actualPrice:e.actualPrice||0,clientType:a.platformType}:e.orderType==="ALBUM"?r.bizContent={musicSheetId:e.id,actualPrice:e.actualPrice||0,clientType:a.platformType}:e.orderType==="PIANO_ROOM"?r.bizContent=e.id:e.orderType==="ACTI_REGIST"&&(r.bizContent={activityId:e.activityId});return r}),y=async s=>{try{const e=u.orderObject,r=a.platformType==="TEACHER"?"/api-teacher/userOrder/executeOrder":"/api-student/userOrder/executeOrder",o=(await l.post(r,{data:{orderName:e.orderName,orderDesc:e.orderDesc,orderType:e.orderType,actualPrice:e.actualPrice||0,recomUserId:e.recomUserId,activityId:e.activityId,orderInfos:[...p()]}})).data||{};o.status=="PAID"?s?s():c.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}):c.alert({message:o.msg,confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"})}catch{c.alert({title:"\u63D0\u793A",message:"\u652F\u4ED8\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF01",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"})}};export{y as a,p as b,u as o,T as r};