index.1347cb0a.js 9.8 KB

1
  1. import{g as Y,w as h,y as l,d as L,Q as z,S as B,V as O,j as r,bt as k,N as M,A as D,bA as E,F as C,B as I,C as V,aS as F,b8 as G,$ as R,D as $}from"./ResizeObserver.es.f28023e0.js";import{L as j}from"./index.79f59946.js";import"./index.b0753b8c.js";import"./index.966d1893.js";import{T as x,a as P}from"./index.aa87c0e3.js";import"./index.c6c54752.js";import{C as H}from"./index.2a22730e.js";import{C as A}from"./index.3b2e70c8.js";import{I as U}from"./index.7a1af785.js";import{S as _}from"./index.22776016.js";import{i as q}from"./icon_member.4d7750c3.js";import{s as c}from"./index.module.37c25674.js";import{C as W}from"./index.bd375ca9.js";import{b as J}from"./bg-image-1.a320f35c.js";import{T as Q}from"./index.787d69a0.js";import{m as K,o as X}from"./index.eb1d9d01.js";import{o as m}from"./orderStatus.00354bd8.js";import{D as Z}from"./index.ff961b8a.js";import"./use-tab-status.653933d8.js";import"./use-id.cc14bbe9.js";import"./use-refs.b4f9d723.js";import"./index.975e8f79.js";import"./index.9a41251d.js";import"./utils.6e3cf8f8.js";import"./index.da2fb993.js";const g=Y.platformType==="STUDENT"?"/api-student":"/api-teacher",ee=async(a,e)=>{var b;const y=a.goodType;let u={};switch(y){case"LIVE":try{const t=await te(a.bizId),i=[];(t.planList||[]).forEach(s=>{const o=s.startTime||new Date,n=s.endTime||new Date;i.push({courseTime:`${h(o).format("YYYY-MM-DD")} ${h(o).format("HH:mm")}~${h(n).format("HH:mm")}`,coursePlan:s.plan,id:s.courseId})}),u={orderType:a.goodType,goodName:a.goodName,courseGroupId:t.courseGroupId,courseGroupName:t.courseGroupName,coursePrice:t.coursePrice,teacherName:t.userName||`\u6E38\u5BA2${t.teacherId||""}`,teacherId:t.teacherId,avatar:t.avatar,courseInfo:i}}catch(t){throw new Error(t.message)}break;case"PRACTICE":{u={...JSON.parse(a.bizContent),teacherName:a.username,starGrade:a.starGrade,avatar:a.avatar};break}case"VIDEO":{try{const t=await ae(a.bizId),{lessonGroup:i,detailList:T}=t;u={orderType:a.goodType,goodName:a.goodName,courseGroupId:i.id,courseGroupName:i.lessonName,coursePrice:i.lessonPrice,teacherName:i.username,teacherId:i.teacherId,avatar:i.avatar,courseInfo:T}}catch(t){throw new Error(t.message)}break}case"VIP":try{const t=await re(a.id);u={orderType:a.goodType,goodName:a.goodName,id:a.id,title:K[t.period]||"",price:e!=null&&e.couponAmount?Number((t.salePrice-e.couponAmount+e.discountPrice).toFixed(2)):t.salePrice||a.actualPrice,startTime:h(t.startTime).format("YYYY-MM-DD"),endTime:h(t.endTime).format("YYYY-MM-DD")}}catch(t){throw new Error(t.message)}break;case"MUSIC":try{const t=await oe(a.bizId);u={orderType:a.goodType,goodName:a.goodName,...t}}catch(t){throw new Error(t.message)}break;case"ALBUM":try{const t=await ne(a.bizId);u={orderType:a.goodType,goodName:a.goodName,...t}}catch(t){throw new Error(t.message)}break;case"TENANT_ALBUM":try{const t=await ce(a.bizId);u={orderType:a.goodType,goodName:a.goodName,...t,purchaseNum:((b=a.bizInfo)==null?void 0:b.bizValidTime)||t.purchaseNum}}catch(t){throw new Error(t.message)}break;case"ACTI_REGIST":try{const t=await se(a.bizId);u={orderType:a.goodType,goodsName:t.activityName,activityId:t.id,actualPrice:t.registrationPrice}}catch(t){throw new Error(t.message)}break}u.orderType=y,u.goodName=a.goodName,m.orderObject.orderList.push(u)},ae=async a=>{try{return(await l.get(`${g}/videoLesson/selectVideoLesson`,{params:{groupId:a}})).data}catch{throw new Error("\u83B7\u53D6\u89C6\u9891\u8BFE\u8BE6\u60C5\u5931\u8D25")}},te=async a=>{try{return(await l.get(`${g}/courseGroup/queryLiveCourseInfo`,{params:{groupId:a}})).data}catch{throw new Error("\u83B7\u53D6\u76F4\u64AD\u8BFE\u8BE6\u60C5\u5931\u8D25")}},re=async a=>{try{return(await l.get(`${g}/vipCardRecord/detail/`+a)).data||[]}catch{throw new Error("\u83B7\u53D6\u4F1A\u5458\u8BE6\u60C5\u5931\u8D25")}},oe=async a=>{try{return(await l.get(`${g}/music/sheet/detail/${a}`)).data}catch{throw new Error("\u83B7\u53D6\u66F2\u76EE\u8BE6\u60C5\u5931\u8D25")}},se=async a=>{try{return(await l.post(`${g}/open/activity/info/${a}`)).data}catch{throw new Error("\u83B7\u53D6\u66F2\u76EE\u8BE6\u60C5\u5931\u8D25")}},ne=async a=>{try{return(await l.post(`${g}/music/album/detail`,{data:{id:a}})).data}catch{throw new Error("\u83B7\u53D6\u4E13\u8F91\u8BE6\u60C5\u5931\u8D25")}},ce=async a=>{try{return(await l.post(`${g}/userTenantAlbumRecord/detail`,{data:{albumId:a}})).data}catch{throw new Error("\u83B7\u53D6\u673A\u6784\u4E13\u8F91\u8BE6\u60C5\u5931\u8D25")}},ue=(a,e)=>{const{orderNo:y,actualPrice:u,orderDesc:b,orderName:t,orderType:i,orderDetailList:T,couponAmount:s,discountPrice:o,paymentConfig:n,paymentVendor:p,paymentVersion:w}=a;m.orderObject.orderType=i,m.orderObject.orderName=t,m.orderObject.orderDesc=b,m.orderObject.actualPrice=u,m.orderObject.orderNo=y,m.orderObject.discountPrice=o,m.orderObject.orderList=[],m.orderObject.paymentConfig={...n,paymentVendor:p,paymentVersion:w};try{T.forEach(async d=>{await ee(d,{couponAmount:s,discountPrice:o})}),e&&e()}catch{}};function ie(a){return typeof a=="function"||Object.prototype.toString.call(a)==="[object Object]"&&!R(a)}var Me=L({name:"MusicList",setup(){const a=z(),e=B({actions:[{name:"\u5F85\u652F\u4ED8",status:"WAIT_PAY"},{name:"\u652F\u4ED8\u4E2D",status:"PAYING"},{name:"\u5DF2\u4ED8\u6B3E",status:"PAID"},{name:"\u5DF2\u5173\u95ED",status:"CLOSE"},{name:"\u652F\u4ED8\u5931\u8D25",status:"FAIL"}],timeStatus:!1,currentSearchDate:new Date,currentDate:new Date,list:[],dataShow:!0,loading:!1,finished:!1,searchName:"\u5168\u90E8",params:{status:"",keyword:"",page:1,rows:20},type:"buy"}),y=async()=>{var s;if(!e.loading){e.loading=!0;try{const o={...e.params,searchDate:h(e.currentSearchDate).format("YYYY-MM")},n=e.type==="buy"?"/api-student/userOrder/page":"/api-student/userOrderRefunds/page",{code:p,data:w}=await l.post(n,{data:{...o,dateTime:e.type==="refund"?o.searchDate:void 0,timeType:e.type==="refund"?"MONTH":void 0}});if(p===200){const d=w||{};(s=d.rows)==null||s.forEach(S=>{(S.orderDetailList||[]).forEach(f=>{const N=f.bizContent?JSON.parse(f.bizContent):{};if(N&&N.purchaseType){const v={MONTH:1,QUARTERLY:3,YEAR_HALF:6,YEAR:12};N.purchaseType==="DAY"?f.unit="\u5929":(f.unit="\u4E2A\u6708",f.bizInfo.bizValidTime=f.bizInfo.bizValidTime*v[N.purchaseType])}else f.unit="\u4E2A\u6708"})}),e.list=e.list.concat(d.rows||[]),e.finished=d.pageNo>=d.totalPage,e.params.page=d.pageNo+1,e.dataShow=e.list.length>0}}catch{e.dataShow=!1,e.finished=!0}e.loading=!1}},u=s=>{e.type!=="refund"&&a.push({path:"/goodsDetail",query:{orderNo:s.orderNo,path:"tradeRecord"}})},b=s=>{e.currentDate=s,e.currentSearchDate=s,e.timeStatus=!1,t()},t=s=>{e.dataShow=!0,e.loading=!1,e.finished=!1,e.list=[],e.params.page=1,e.params.keyword=s,y()},i=async s=>{$.confirm({message:"\u662F\u5426\u53D6\u6D88\u8BA2\u5355\uFF1F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"var(--van-primary)",cancelButtonText:"\u53D6\u6D88"}).then(async()=>{try{await l.post("/api-student/userOrder/orderCancel",{data:{orderNo:s.orderNo}}),t()}catch{}})},T=async s=>{try{const n=(await l.get(`/api-student/userOrder/detailByOrderNo/${s.orderNo}`)).data;ue({...n,paymentConfig:s.paymentConfig},()=>{a.push({path:"/orderDetail",query:{orderType:n.orderType}})})}catch{}};return O(()=>{y()}),()=>{let s;return r(C,null,[r("div",{class:c.sticky},[r(Q,null,{default:()=>[r(W,{background:"transparent",isFixed:!1,border:!1,color:"#131415"},null),r(_,{onSearch:t,type:"tenant",background:"transparent",inputBackground:"transparent"},{left:()=>r("div",{class:c.label,onClick:()=>e.timeStatus=!0},[k(e.currentSearchDate,"YYYY-MM"),r(M,{classPrefix:"iconfont",name:"down",size:12,color:"#948D93"},null)])}),r(x,{color:"var(--van-primary)",background:"transparent",lineWidth:20,shrink:!0,class:c.tagTabs,"onClick-tab":o=>{e.type=o.name==="REFUND"?"refund":"buy",e.params.status=o.name,t()}},{default:()=>[r(P,{title:"\u5168\u90E8",name:""},null),e.actions.map(o=>r(P,{title:o.name,name:o.status},null))]})]}),r("img",{class:c.bgImg,src:J},null)]),r("div",{class:c.tradeList},[e.dataShow?r(j,{finished:e.finished,finishedText:" ",class:[c.list],onLoad:y},ie(s=e.list.map(o=>r(H,{border:!1,onClick:()=>{u(o)}},{default:()=>[r(A,{border:!1,title:h(o.createTime).format("YYYY-MM-DD HH:mm"),value:e.type==="buy"?X[o.status]:o.operateReason,valueClass:c.tradeType},null),o.orderDetailList&&o.orderDetailList.map(n=>r(A,{border:!1,class:c.orderSection},{icon:()=>{var p;return r(U,{src:n.goodType==="VIP"?q:(p=n.bizInfo)==null?void 0:p.bizCover,class:c.tradeLogo},null)},title:()=>{var p,w,d;return r("div",{class:c.goodsSection},[r("div",{class:[c.title]},[r("span",{class:[c.name,"van-ellipsis"]},[(p=n.bizInfo)==null?void 0:p.bizName]),r("span",{class:c.desc},[D("\xA5"),E(n.actualPrice)])]),r("div",{class:c.description},[r("span",{class:[c.d,"van-ellipsis"]},[(w=n.bizInfo)==null?void 0:w.bizDesc]),n.goodType!=="VIP"&&r(C,null,[n.goodType==="TENANT_ALBUM"?r("span",{class:c.t},[D("x"),(d=n.bizInfo)==null?void 0:d.bizValidTime,n.unit]):r("span",{class:c.t},[D("\u6C38\u4E45")])])])])}})),r("div",{class:c.paymentPrice},[["PAYING","WAIT_PAY"].includes(o.status)?"\u9700\u4ED8\u6B3E":o.status==="CLOSE"?"\u8BA2\u5355\u91D1\u989D":"\u5B9E\u4ED8\u6B3E",r("span",null,[r("i",null,[D("\xA5")]),E(o.actualPrice)])]),o.status==="PAYING"||o.status==="WAIT_PAY"?r("div",{class:c.btnList},[r(I,{size:"small",round:!0,onClick:n=>{n.stopPropagation(),i(o)}},{default:()=>[D("\u53D6\u6D88\u8BA2\u5355")]}),r(I,{size:"small",round:!0,type:"primary",onClick:n=>{n.stopPropagation(),T(o)}},{default:()=>[D("\u7EE7\u7EED\u4ED8\u6B3E")]})]):null]})))?s:{default:()=>[s]}):r(V,{btnStatus:!1,classImgSize:"CERT",tips:e.type==="buy"?"\u6682\u65E0\u8D2D\u4E70\u8BB0\u5F55":"\u6682\u65E0\u9000\u6B3E\u8BB0\u5F55"},null)]),r(F,{show:e.timeStatus,"onUpdate:show":o=>e.timeStatus=o,position:"bottom",round:!0,closeOnPopstate:!0},{default:()=>[r(Z,{type:"year-month",modelValue:e.currentDate,"onUpdate:modelValue":o=>e.currentDate=o,formatter:G,onCancel:()=>{e.timeStatus=!1},onConfirm:b},null)]})])}}});export{Me as default};