index.d24aad58.js 6.3 KB

1
  1. import{t as l,e as c,d as _,D as S,i as a,J as p,w as d,B as m,C as w,aQ as C,b0 as N,V as P}from"./index.cbd02a57.js";import{A as b}from"./index.b9b06758.js";import{C as u}from"./index.12924b6f.js";import{C as L}from"./index.7b402c85.js";import"./index.b4a7df5d.js";import{S as Y}from"./index.6a7506ff.js";import{L as x}from"./index.1571220e.js";import{m as O,o as v,g as A}from"./index.e01717aa.js";import{o as n}from"./orderStatus.e1ddea21.js";import{C as E}from"./index.cff475d7.js";import{u as F}from"./hooks.500257aa.js";import{D as j}from"./index.a2ba315f.js";import"./use-tab-status.93679e69.js";import"./index.aae351bf.js";import"./use-height.4fd871a3.js";import"./utils.0517a2ae.js";import"./index.8ea82665.js";const M="_tradeList_ums1x_1",k="_searchTime_ums1x_1",I="_searchType_ums1x_2",B="_list_ums1x_14",V="_tradeLogo_ums1x_17",z="_tradeType_ums1x_24",$="_title_ums1x_27",R="_content_ums1x_28",q="_desc_ums1x_37",G="_num_ums1x_38",H="_btnList_ums1x_43";var i={tradeList:M,searchTime:k,searchType:I,list:B,tradeLogo:V,tradeType:z,title:$,content:R,desc:q,num:G,btnList:H};const U=async(t,e)=>{const r=t.goodType;let o={};switch(r){case"PINAO_ROOM":try{const s=await W(t.bizId);console.log("res",s),o={orderType:t.goodType,goodsName:t.goodName,...s}}catch(s){throw new Error(s.message)}break;case"VIP":try{const s=await J(t.id);o={orderType:t.goodType,goodName:t.goodName,id:t.id,title:O[s.period]||"",price:e!=null&&e.couponAmount?Number((s.salePrice-e.couponAmount+e.discountPrice).toFixed(2)):s.salePrice||t.actualPrice,startTime:l(s.startTime).format("YYYY-MM-DD"),endTime:l(s.endTime).format("YYYY-MM-DD")}}catch(s){throw new Error(s.message)}break}o.orderType=r,o.goodName=t.goodName,n.orderObject.orderList.push(o)},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")}},Q=(t,e)=>{const{orderNo:r,actualPrice:o,orderDesc:s,orderName:f,orderType:y,orderDetailList:g,couponAmount:T,discountPrice:h}=t;n.orderObject.orderType=y,n.orderObject.orderName=f,n.orderObject.orderDesc=s,n.orderObject.orderNo=r,n.orderObject.actualPrice=o,n.orderObject.discountPrice=h,n.orderObject.orderList=[],console.log(t);try{g.forEach(async D=>{await U(D,{couponAmount:T,discountPrice:h})}),e&&e()}catch{}};function K(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!P(t)}var ft=_({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:l(this.currentDate).format("YYYY-MM")},{code:e,data:r}=await c.post("/api-teacher/userOrder/page",{data:{...t}});if(e===200){const o=r||{};this.list=this.list.concat(o.rows||[]),this.finished=o.pageNo>=o.totalPage,this.params.page=o.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){S.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 r=(await c.get(`/api-teacher/userOrder/detailByOrderNo/${t.orderNo}`)).data;Q(r,()=>{this.$router.push({path:"/orderDetail",query:{orderType:r.orderType}})})}catch{}}},render(){let t;return a("div",{class:i.tradeList},[a(Y,{position:"top"},{default:()=>[a(E,{isFixed:!1},null),a(u,{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(x,{loading:this.loading,finished:this.finished,finishedText:" ",class:[i.list],onLoad:this.getList},K(t=this.list.map(e=>a(L,{border:!1,onClick:()=>{this.onDetail(e)}},{default:()=>[a(u,{title:l(e.createTime).format("YYYY-MM-DD HH:mm"),value:v[e.status],valueClass:i.tradeType},null),a(u,{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:r=>{r.stopPropagation(),this.onCancelPay(e)}},{default:()=>[d("\u53D6\u6D88\u8BA2\u5355")]}),a(m,{size:"small",round:!0,type:"primary",onClick:r=>{r.stopPropagation(),this.onPay(e)}},{default:()=>[d("\u7EE7\u7EED\u652F\u4ED8")]})]):null]})))?t:{default:()=>[t]}):a(w,{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(j,{type:"year-month",modelValue:this.currentDate,"onUpdate:modelValue":e=>this.currentDate=e,formatter:N,onCancel:()=>{this.timeStatus=!1},onConfirm:this.onConfirm},null)]}),a(b,{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{ft as default};