import{x as u,e as c,d as w,D as _,i as a,N as p,A as d,B as m,C as S,aT as N,b2 as C,$ as b}from"./index.7994470a.js";import{A as P}from"./index.e11930ae.js";import{C as l}from"./index.777f4790.js";import{C as L}from"./index.9cdb5783.js";import"./index.b5726455.js";import{S as E}from"./index.6449f9de.js";import{L as Y}from"./index.ec643df3.js";import{m as x,o as O,g as A}from"./index.e6c57a63.js";import{o as n}from"./orderStatus.020f67a3.js";import{C as v}from"./index.c5bf3ab5.js";import{u as F}from"./hooks.04c1f931.js";import{D as B}from"./index.e89aa9d7.js";import"./use-tab-status.00d7316c.js";import"./index.0a2aeb2c.js";import"./use-height.ffa5a0f3.js";import"./utils.4585c89d.js";import"./index.7273768c.js";const M="_tradeList_ums1x_1",I="_searchTime_ums1x_1",k="_searchType_ums1x_2",j="_list_ums1x_14",z="_tradeLogo_ums1x_17",$="_tradeType_ums1x_24",V="_title_ums1x_27",R="_content_ums1x_28",U="_desc_ums1x_37",q="_num_ums1x_38",G="_btnList_ums1x_43";var i={tradeList:M,searchTime:I,searchType:k,list:j,tradeLogo:z,tradeType:$,title:V,content:R,desc:U,num:q,btnList:G};const H=async(t,e)=>{const o=t.goodType;let r={};switch(o){case"PIANO_ROOM":try{const s=await W(t.bizId);console.log("res",s),r={orderType:t.goodType,goodsName:t.goodName,...s}}catch(s){throw new Error(s.message)}break;case"VIP":try{const s=await J(t.id);r={orderType:t.goodType,goodName:t.goodName,id:t.id,title:x[s.period]||"",price:e!=null&&e.couponAmount?Number((s.salePrice-e.couponAmount+e.discountPrice).toFixed(2)):s.salePrice||t.actualPrice,startTime:u(s.startTime).format("YYYY-MM-DD"),endTime:u(s.endTime).format("YYYY-MM-DD")}}catch(s){throw new Error(s.message)}break;case"MUSIC":try{const s=await K(t.bizId);r={orderType:t.goodType,goodName:t.goodName,...s}}catch(s){throw new Error(s.message)}break;case"ALBUM":try{const s=await Q(t.bizId);r={orderType:t.goodType,goodName:t.goodName,...s}}catch(s){throw new Error(s.message)}break}r.orderType=o,r.goodName=t.goodName,n.orderObject.orderList.push(r)},W=async t=>{try{return(await c.get(`/api-teacher/pianoRoomSettings/detail/${t}`)).data}catch{throw new Error("\u83B7\u53D6\u65F6\u957F\u8BE6\u60C5\u5931\u8D25")}},J=async t=>{try{return(await c.get("/api-teacher/vipCardRecord/detail/"+t)).data||[]}catch{throw new Error("\u83B7\u53D6\u4F1A\u5458\u8BE6\u60C5\u5931\u8D25")}},K=async t=>{try{return(await c.get(`/api-teacher/music/sheet/detail/${t}`)).data}catch{throw new Error("\u83B7\u53D6\u66F2\u76EE\u8BE6\u60C5\u5931\u8D25")}},Q=async t=>{try{return(await c.post("/api-teacher/music/album/detail",{data:{id:t}})).data}catch{throw new Error("\u83B7\u53D6\u4E13\u8F91\u8BE6\u60C5\u5931\u8D25")}},X=(t,e)=>{const{orderNo:o,actualPrice:r,orderDesc:s,orderName:y,orderType:f,orderDetailList:g,couponAmount:D,discountPrice:h}=t;n.orderObject.orderType=f,n.orderObject.orderName=y,n.orderObject.orderDesc=s,n.orderObject.orderNo=o,n.orderObject.actualPrice=r,n.orderObject.discountPrice=h,n.orderObject.orderList=[],console.log(t);try{g.forEach(async T=>{await H(T,{couponAmount:D,discountPrice:h})}),e&&e()}catch{}};function Z(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!b(t)}var gt=w({name:"list",data(){return{timeStatus:!1,currentDate:new Date,typeStatus:!1,actions:[{name:"\u5168\u90E8"},{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"}],list:[],dataShow:!0,loading:!1,finished:!1,searchName:"\u5168\u90E8",params:{status:"",page:1,rows:20}}},mounted(){F("\u4EA4\u6613\u8BB0\u5F55")},methods:{async getList(){if(!this.loading){this.loading=!0;try{const t={...this.params,searchDate:u(this.currentDate).format("YYYY-MM")},{code:e,data:o}=await c.post("/api-teacher/userOrder/page",{data:{...t}});if(e===200){const r=o||{};this.list=this.list.concat(r.rows||[]),this.finished=r.pageNo>=r.totalPage,this.params.page=r.pageNo+1,this.dataShow=this.list.length>0}}catch{this.dataShow=!1,this.finished=!0}this.loading=!1}},onDetail(t){this.$router.push({path:"/tradeDetail",query:{orderNo:t.orderNo,path:"tradeRecord"}})},onConfirm(t){this.currentDate=t,this.timeStatus=!1,this.onSearch()},onSelect(t){this.params.status=t.status,this.searchName=t.name,this.onSearch()},onSearch(){this.dataShow=!0,this.loading=!1,this.finished=!1,this.list=[],this.params.page=1,this.getList()},async onCancelPay(t){_.confirm({message:"\u662F\u5426\u53D6\u6D88\u8BA2\u5355\uFF1F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"var(--van-primary)",cancelButtonText:"\u53D6\u6D88"}).then(async()=>{try{await c.post("/api-teacher/userOrder/orderCancel",{data:{orderNo:t.orderNo}}),this.onSearch()}catch{}})},async onPay(t){try{const o=(await c.get(`/api-teacher/userOrder/detailByOrderNo/${t.orderNo}`)).data;X(o,()=>{this.$router.push({path:"/orderDetail",query:{orderType:o.orderType}})})}catch{}}},render(){let t;return a("div",{class:i.tradeList},[a(E,{position:"top"},{default:()=>[a(v,{isFixed:!1},null),a(l,{center:!0,style:{backgroundColor:"#F7F8F9"}},{title:()=>a("div",{class:i.searchTime,onClick:()=>{this.timeStatus=!0}},[a("span",null,[this.$filters.dateFormat(this.currentDate,"YYYY-MM")]),a(p,{classPrefix:"iconfont",name:"down",size:12,color:"var(--van-primary)"},null)]),value:()=>a("div",{class:i.searchType,onClick:()=>{this.typeStatus=!0}},[a("span",null,[this.searchName]),a(p,{classPrefix:"iconfont",name:"down",size:12,color:"var(--van-primary)"},null)])})]}),this.dataShow?a(Y,{loading:this.loading,finished:this.finished,finishedText:" ",class:[i.list],onLoad:this.getList},Z(t=this.list.map(e=>a(L,{border:!1,onClick:()=>{this.onDetail(e)}},{default:()=>[a(l,{title:u(e.createTime).format("YYYY-MM-DD HH:mm"),value:O[e.status],valueClass:i.tradeType},null),a(l,{border:!1},{title:()=>a("div",{class:i.title},[a("span",null,[e.orderName]),a("span",{class:i.desc},[A[e.orderType]])]),default:()=>a("div",{class:i.content},[a("span",{class:i.price},[d("\uFFE5"),this.$filters.moneyFormat(e.actualPrice)])])}),e.status==="PAYING"||e.status==="WAIT_PAY"?a("div",{class:i.btnList},[a(m,{size:"small",round:!0,onClick:o=>{o.stopPropagation(),this.onCancelPay(e)}},{default:()=>[d("\u53D6\u6D88\u8BA2\u5355")]}),a(m,{size:"small",round:!0,type:"primary",onClick:o=>{o.stopPropagation(),this.onPay(e)}},{default:()=>[d("\u7EE7\u7EED\u652F\u4ED8")]})]):null]})))?t:{default:()=>[t]}):a(S,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u8D2D\u4E70\u8BB0\u5F55"},null),a(N,{show:this.timeStatus,"onUpdate:show":e=>this.timeStatus=e,position:"bottom",round:!0,closeOnPopstate:!0},{default:()=>[a(B,{type:"year-month",modelValue:this.currentDate,"onUpdate:modelValue":e=>this.currentDate=e,formatter:C,onCancel:()=>{this.timeStatus=!1},onConfirm:this.onConfirm},null)]}),a(P,{show:this.typeStatus,"onUpdate:show":e=>this.typeStatus=e,actions:this.actions,closeOnClickAction:!0,cancelText:"\u53D6\u6D88",onSelect:this.onSelect,onCancel:()=>{this.typeStatus=!1}},null)])}});export{gt as default};