import{S as f,g as d,y as b,D as p,f as l,w as y}from"./ResizeObserver.es.b7226882.js";const T=()=>({orderType:"",orderInfo:{orderNo:"",actualPrice:0,payStatus:!0},orderObject:{orderNo:"",actualPrice:0,orderName:"",orderDesc:"",orderType:"",recomUserId:null,orderList:[],activityId:"",couponId:"",couponAmount:0,couponDiscountPrice:0,discountCardPrice:0,discountPrice:0}}),t=f(T()),N=()=>{Object.assign(t,T())},I=u=>{if(u.vipEndDays>0){const e=y(u.startTime).add(u.vipEndDays,"day"),s=u.period==="YEAR"?"years":"months",c=e.diff(y(u.startTime),s);return u.period==="MONTH"?c+1:u.period==="QUARTERLY"?Math.ceil((c+1)/3):u.period==="YEAR_HALF"?Math.ceil((c+1)/6):u.period==="YEAR"?c+1:1}return 1},C=()=>(t.orderObject.orderList||[]).map(e=>{const s={goodType:e.orderType,goodName:e.goodsName,recomUserId:e.recomUserId,bizContent:{}};if(e.orderType==="VIDEO")s.bizContent={videoLessonGroupId:e.courseGroupId,payMoney:e.coursePrice||0};else if(e.orderType==="LIVE"||e.orderType==="GROUP")s.bizContent={groupId:e.courseGroupId};else if(e.orderType==="PRACTICE"||e.orderType==="VIP_COURSE"){const c=e.classTime||[],r=[];c.forEach(o=>{r.push({classDate:o.classDate,startTime:o.startTime,endTime:o.endTime})}),s.bizContent={courseGroupName:e.courseGroupName,courseIntroduce:e.courseIntroduce,subjectId:e.subjectId,singleCourseMinutes:e.singleCourseMinutes,courseNum:e.courseNum,coursePrice:e.coursePrice,teacherId:e.teacherId,classTime:r}}else if(e.orderType==="VIP")s.bizContent=e.id,s.goodsNum=e.num,s.bizPrice=e.salePrice;else if(e.orderType==="SVIP"){s.bizContent=e.id;const c=I(e);s.vipEndDays=e.num>c?e.vipEndDays:null,s.goodsNum=e.num,s.bizPrice=e.salePrice}else e.orderType==="MUSIC"?s.bizContent={musicSheetId:e.id,actualPrice:e.actualPrice||0,clientType:d.platformType}:e.orderType==="ALBUM"?s.bizContent={musicSheetId:e.id,actualPrice:e.actualPrice||0,clientType:d.platformType}:e.orderType==="PIANO_ROOM"?s.bizContent=e.id:e.orderType==="ACTI_REGIST"?s.bizContent={activityId:e.activityId}:e.orderType==="TENANT_ALBUM"&&(s.bizContent={musicSheetId:e.id,actualPrice:e.actualPrice||0,clientType:d.platformType});return s}),g=(u=[])=>{let e=[];u&&u.length>0?e=u||[]:e=t.orderObject.orderList||[];const s=[];return[...e.map(r=>{const o={goodType:r.orderType,goodName:r.goodsName,goodNum:1,bizContent:{}};if(r.orderType==="VIP")o.bizContent=r.id,o.bizId=r.id,o.goodsNum=r.num,o.goodNum=r.num,(r.activityList||[]).map(n=>{s.push(n)});else if(r.orderType==="SVIP"){o.bizContent=r.id;const n=I(r);o.vipEndDays=r.num>n?r.vipEndDays:null,o.goodsNum=r.num,o.goodNum=r.num,(r.activityList||[]).map(a=>{s.push(a)})}else if(r.orderType==="MUSIC")o.bizContent={musicSheetId:r.id,actualPrice:r.actualPrice||0,clientType:d.platformType},o.bizId=r.id;else if(r.orderType==="ALBUM")o.bizContent={musicSheetId:r.id,actualPrice:r.actualPrice||0,clientType:d.platformType},o.bizId=r.id;else if(r.orderType==="TENANT_ALBUM")console.log(r,"item"),o.bizContent={tenantAlbumId:r.id,actualPrice:r.actualPrice||0,buyNumber:1,buyMultiple:1,clientType:d.platformType},o.tenantGroupAlbumId=r.tenantGroupAlbumId,o.bizId=r.id,o.buyNumber=1,o.buyMultiple=1;else if(r.orderType==="LIVE"||r.orderType==="GROUP")o.bizContent={groupId:r.courseGroupId};else if(r.orderType==="VIDEO")o.bizContent={videoLessonGroupId:r.courseGroupId,payMoney:r.coursePrice||0};else if(r.orderType==="PRACTICE"||r.orderType==="VIP_COURSE"){const n=r.classTime||[],a=[];n.forEach(i=>{a.push({classDate:i.classDate,startTime:i.startTime,endTime:i.endTime})}),o.bizContent={courseGroupName:r.courseGroupName,courseIntroduce:r.courseIntroduce,teacherSubjectPriceId:r.teacherSubjectPriceId,subjectId:r.subjectId,singleCourseMinutes:r.singleCourseMinutes,courseNum:r.courseNum,coursePrice:r.coursePrice,teacherId:r.teacherId,classTime:a}}else r.orderType==="PIANO_ROOM"?o.bizContent=r.id:r.orderType==="ACTI_REGIST"?o.bizContent={activityId:r.activityId}:r.orderType=="DISCOUNT"&&(o.bizContent=r.id,o.goodsNum=r.num,o.goodNum=r.num);return o}),...s]},E=async u=>{try{const e=t.orderObject,s=d.platformType==="TEACHER"?"/api-teacher/userOrder/executeOrder":"/api-student/userOrder/executeOrder",r=(await b.post(s,{data:{orderName:e.orderName,orderDesc:e.orderDesc,orderType:e.orderType,actualPrice:e.actualPrice||0,recomUserId:e.recomUserId,activityId:e.activityId,orderInfos:[...C()]}})).data||{};r.status=="PAID"?u?u():p.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}):p.alert({message:r.msg,confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"})}catch{p.alert({title:"\u63D0\u793A",message:"\u652F\u4ED8\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF01",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"})}},z=u=>{let e="qrCode";return l().weixin?u=="alipay_qr"||u=="alipay_wap"?e="qrCode":u=="wx_pub"&&(e="pay"):l().alipay&&u=="alipay_wap"?e="pay":e="qrCode",e=="qrCode"?"payDefine":"payResult"};export{E as a,z as b,C as c,g as d,t as o,N as r};