index.86b2495b.js 6.8 KB

1
  1. import{u,w as c,d as T,D as _,j as a,M as p,z as d,B as m,C as S,aR as C,b1 as N,Z as b}from"./index.394decd7.js";import{A as P}from"./index.4b9edf44.js";import{C as l}from"./index.9e0d46e4.js";import{C as L}from"./index.9462d7c5.js";import"./index.cf474e9d.js";import{S as E}from"./index.3bbf4ddb.js";import{L as Y}from"./index.dc786267.js";import{m as x,o as O,g as A}from"./index.68f32c85.js";import{o as n}from"./orderStatus.535346ee.js";import{C as v}from"./index.e6e212d8.js";import{u as F}from"./hooks.9e5ee122.js";import{D as M}from"./index.44f74499.js";import"./use-tab-status.723110ee.js";import"./utils.ae753603.js";import"./index.1dcc495a.js";const B="_tradeList_ums1x_1",I="_searchTime_ums1x_1",j="_searchType_ums1x_2",k="_list_ums1x_14",z="_tradeLogo_ums1x_17",V="_tradeType_ums1x_24",$="_title_ums1x_27",R="_content_ums1x_28",U="_desc_ums1x_37",q="_num_ums1x_38",G="_btnList_ums1x_43";var i={tradeList:B,searchTime:I,searchType:j,list:k,tradeLogo:z,tradeType:V,title:$,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 Z(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 J(t.bizId);r={orderType:t.goodType,goodName:t.goodName,...s}}catch(s){throw new Error(s.message)}break;case"ALBUM":try{const s=await K(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")}},Z=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")}},J=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")}},K=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")}},Q=(t,e)=>{const{orderNo:o,actualPrice:r,orderDesc:s,orderName:y,orderType:f,orderDetailList:g,couponAmount:w,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 D=>{await H(D,{couponAmount:w,discountPrice:h})}),e&&e()}catch{}};function X(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!b(t)}var yt=T({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;Q(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},X(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(C,{show:this.timeStatus,"onUpdate:show":e=>this.timeStatus=e,position:"bottom",round:!0,closeOnPopstate:!0},{default:()=>[a(M,{type:"year-month",modelValue:this.currentDate,"onUpdate:modelValue":e=>this.currentDate=e,formatter:N,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{yt as default};