1 |
- import{Q as l,g as a,w as p,D as d,f as n}from"./index.394decd7.js";const i=()=>({orderType:"",orderInfo:{orderNo:"",actualPrice:0,payStatus:!0},orderObject:{orderNo:"",actualPrice:0,orderName:"",orderDesc:"",orderType:"",recomUserId:null,orderList:[],activityId:"",couponId:"",discountPrice:0}}),t=l(i()),I=()=>{Object.assign(t,i())},y=()=>(t.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 u=e.classTime||[],s=[];u.forEach(c=>{s.push({classDate:c.classDate,startTime:c.startTime,endTime:c.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:s}}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}:e.orderType==="TENANT_ALBUM"&&(r.bizContent={musicSheetId:e.id,actualPrice:e.actualPrice||0,clientType:a.platformType});return r}),f=()=>(t.orderObject.orderList||[]).map(e=>{const r={goodType:e.orderType,goodName:e.goodsName,goodNum:1,bizContent:{}};if(e.orderType==="VIP")r.bizContent=e.id,r.bizId=e.id;else if(e.orderType==="MUSIC")r.bizContent={musicSheetId:e.id,actualPrice:e.actualPrice||0,clientType:a.platformType},r.bizId=e.id;else if(e.orderType==="ALBUM")r.bizContent={musicSheetId:e.id,actualPrice:e.actualPrice||0,clientType:a.platformType},r.bizId=e.id;else if(e.orderType==="TENANT_ALBUM")r.bizContent={tenantAlbumId:e.id,actualPrice:e.actualPrice||0,buyNumber:1,buyMultiple:e.purchaseCycle/6,clientType:a.platformType},r.bizId=e.id,r.buyNumber=1,r.buyMultiple=e.purchaseCycle/6;else if(e.orderType==="LIVE")r.bizContent={groupId:e.courseGroupId};else if(e.orderType==="VIDEO")r.bizContent={videoLessonGroupId:e.courseGroupId,payMoney:e.coursePrice||0};else if(e.orderType==="PRACTICE"){const u=e.classTime||[],s=[];u.forEach(c=>{s.push({classDate:c.classDate,startTime:c.startTime,endTime:c.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:s}}else e.orderType==="PIANO_ROOM"?r.bizContent=e.id:e.orderType==="ACTI_REGIST"&&(r.bizContent={activityId:e.activityId});return r}),C=async o=>{try{const e=t.orderObject,r=a.platformType==="TEACHER"?"/api-teacher/userOrder/executeOrder":"/api-student/userOrder/executeOrder",s=(await p.post(r,{data:{orderName:e.orderName,orderDesc:e.orderDesc,orderType:e.orderType,actualPrice:e.actualPrice||0,recomUserId:e.recomUserId,activityId:e.activityId,orderInfos:[...y()]}})).data||{};s.status=="PAID"?o?o():d.alert({message:"\u9886\u53D6\u6210\u529F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"}):d.alert({message:s.msg,confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"})}catch{d.alert({title:"\u63D0\u793A",message:"\u652F\u4ED8\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\uFF01",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"#2dc7aa"})}},b=o=>{let e="qrCode";return n().weixin?o=="alipay_qr"||o=="alipay_wap"?e="qrCode":o=="wx_pub"&&(e="pay"):n().alipay&&o=="alipay_wap"?e="pay":e="qrCode",e=="qrCode"?"payDefine":"payResult"};export{C as a,b,y as c,f as d,t as o,I as r};
|