1 |
- import{d as g,w as h,y as o,D as _,g as S,j as t,N as p,A as n,B as m,C as T,aS as v,b8 as D,$ as b}from"./ResizeObserver.es.39b48a47.js";import{S as C}from"./index.608320e9.js";import"./index.0e35d2fb.js";import{T as L,a as f}from"./index.5d4d28cc.js";import{A as x}from"./index.b6a283d2.js";import{C as l}from"./index.db115763.js";import{C as N}from"./index.9f5e14d1.js";import"./index.b8eefd8d.js";import{L as w}from"./index.6c529ad4.js";import{o as P,g as k}from"./index.07111672.js";import{t as Y}from"./tradeOrder.c5307744.js";import{D as A}from"./index.c1da7507.js";import{u as O}from"./hooks.6df65925.js";import{C as E}from"./index.970ad07b.js";import{T as F}from"./index.e90d2179.js";import"./use-id.b004ff17.js";import"./use-tab-status.bcc0c503.js";import"./use-refs.07204da6.js";import"./orderStatus.fbc0ddaf.js";import"./utils.eda083a9.js";import"./index.6617ac99.js";import"./index.dc19bc54.js";const R="_tradeRecord_k8m2o_1",$="_tab_k8m2o_11";var B={tradeRecord:R,tab:$};const I="_tradeList_ums1x_1",M="_searchTime_ums1x_1",V="_searchType_ums1x_2",j="_list_ums1x_14",z="_tradeLogo_ums1x_17",H="_tradeType_ums1x_24",U="_title_ums1x_27",q="_content_ums1x_28",G="_desc_ums1x_37",W="_num_ums1x_38",J="_btnList_ums1x_43";var a={tradeList:I,searchTime:M,searchType:V,list:j,tradeLogo:z,tradeType:H,title:U,content:q,desc:G,num:W,btnList:J};function K(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!b(e)}var y=g({name:"list",props:{type:{type:String,default:"buy"},height:{type:Number,default:44}},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}}},methods:{async getList(){if(!this.loading){this.loading=!0;try{const e={...this.params,searchDate:h(this.currentDate).format("YYYY-MM")},s=this.type==="buy"?"/api-student/userOrder/page":"/api-student/userOrderRefunds/page",{code:r,data:u}=await o.post(s,{data:{...e,dateTime:this.type==="refund"?e.searchDate:void 0,timeType:this.type==="refund"?"MONTH":void 0}});if(r===200){const i=u||{};this.list=this.list.concat(i.rows||[]),this.finished=i.pageNo>=i.totalPage,this.params.page=i.pageNo+1,this.dataShow=this.list.length>0}}catch{this.dataShow=!1,this.finished=!0}this.loading=!1}},onDetail(e){this.type!=="refund"&&this.$router.push({path:"/tradeDetail",query:{orderNo:e.orderNo,path:"tradeRecord"}})},onConfirm(e){this.currentDate=e,this.timeStatus=!1,this.onSearch()},onSelect(e){this.params.status=e.status,this.searchName=e.name,this.onSearch()},onSearch(){this.dataShow=!0,this.loading=!1,this.finished=!1,this.list=[],this.params.page=1,this.getList()},async onCancelPay(e){_.confirm({message:"\u662F\u5426\u53D6\u6D88\u8BA2\u5355\uFF1F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"var(--van-primary)",cancelButtonText:"\u53D6\u6D88"}).then(async()=>{try{await o.post("/api-student/userOrder/orderCancel",{data:{orderNo:e.orderNo}}),this.onSearch()}catch{}})},async onPay(e){try{const r=(await o.get(`/api-student/userOrder/detailByOrderNo/${e.orderNo}`)).data;(r.orderDetailList||[]).forEach(i=>{var d,c;i.vipEndDays=((c=(d=S.user.data)==null?void 0:d.userVip)==null?void 0:c.vipEndDays)||0}),Y(r,()=>{this.$router.push({path:"/orderDetail",query:{orderType:r.orderType}})})}catch{}}},render(){let e;return t("div",{class:a.tradeList},[t(C,{position:"top",offsetTop:this.height},{default:()=>[t(l,{center:!0,style:{backgroundColor:"#F7F8F9"}},{title:()=>t("div",{class:a.searchTime,onClick:()=>{this.timeStatus=!0}},[t("span",null,[this.$filters.dateFormat(this.currentDate,"YYYY-MM")]),t(p,{classPrefix:"iconfont",name:"down",size:12,color:"var(--van-primary)"},null)]),value:()=>this.type==="buy"?t("div",{class:a.searchType,onClick:()=>{this.typeStatus=!0}},[t("span",null,[this.searchName]),t(p,{classPrefix:"iconfont",name:"down",size:12,color:"var(--van-primary)"},null)]):null})]}),this.dataShow?t(w,{loading:this.loading,finished:this.finished,finishedText:" ",class:[a.list],onLoad:this.getList},K(e=this.list.map(s=>t(N,{border:!1,onClick:()=>{this.onDetail(s)}},{default:()=>[t(l,{title:h(s.createTime).format("YYYY-MM-DD HH:mm"),value:this.type==="buy"?P[s.status]:s.operateReason,valueClass:a.tradeType},null),t(l,{border:!1},{title:()=>t("div",{class:a.title},[t("span",null,[s.orderName]),t("span",{class:a.desc},[k[s.orderType]])]),default:()=>t("div",{class:a.content},[t("span",{class:a.price},[n("\uFFE5"),this.type==="buy"?this.$filters.moneyFormat(s.actualPrice):this.$filters.moneyFormat(s.actualAmount)])])}),s.status==="PAYING"||s.status==="WAIT_PAY"?t("div",{class:a.btnList},[t(m,{size:"small",round:!0,onClick:r=>{r.stopPropagation(),this.onCancelPay(s)}},{default:()=>[n("\u53D6\u6D88\u8BA2\u5355")]}),t(m,{size:"small",round:!0,type:"primary",onClick:r=>{r.stopPropagation(),this.onPay(s)}},{default:()=>[n("\u7EE7\u7EED\u652F\u4ED8")]})]):null]})))?e:{default:()=>[e]}):t(T,{btnStatus:!1,classImgSize:"SMALL",tips:this.type==="buy"?"\u6682\u65E0\u8D2D\u4E70\u8BB0\u5F55":"\u6682\u65E0\u9000\u6B3E\u8BB0\u5F55"},null),t(v,{show:this.timeStatus,"onUpdate:show":s=>this.timeStatus=s,position:"bottom",round:!0,closeOnPopstate:!0},{default:()=>[t(A,{type:"year-month",modelValue:this.currentDate,"onUpdate:modelValue":s=>this.currentDate=s,formatter:D,onCancel:()=>{this.timeStatus=!1},onConfirm:this.onConfirm},null)]}),t(x,{show:this.typeStatus,"onUpdate:show":s=>this.typeStatus=s,actions:this.actions,closeOnClickAction:!0,cancelText:"\u53D6\u6D88",onSelect:this.onSelect,onCancel:()=>{this.typeStatus=!1}},null)])}}),St=g({name:"tradeRecord",data(){return{active:"buy",height:44}},mounted(){O("\u4EA4\u6613\u8BB0\u5F55")},render(){return t("div",{class:B.tradeRecord},[t(F,{position:"top",onBarHeight:e=>{this.height=e}},{default:()=>[t(E,{isFixed:!1},null),t(L,{active:this.active,"onUpdate:active":e=>this.active=e,color:"var(--van-primary)",sticky:!0,lineWidth:28},{default:()=>[t(f,{name:"buy",title:"\u8D2D\u4E70\u8BB0\u5F55"},null),t(f,{name:"refund",title:"\u9000\u8D39\u8BB0\u5F55"},null)]})]}),this.active==="buy"&&t(y,{height:this.height,key:"buy"},null),this.active==="refund"&&t(y,{height:this.height,type:"refund",key:"refund"},null)])}});export{St as default};
|