1 |
- import{d as f,u as l,w as n,D as g,j as t,M as c,z as o,B as d,C as _,aR as T,b1 as S,Z as b,X as v}from"./index.e6d6174e.js";import{S as D}from"./index.9093bc60.js";import"./index.b4a53c6a.js";import{T as C,a as h}from"./index.54627972.js";import{A as L}from"./index.8ec5fd1e.js";import{C as u}from"./index.af99cf22.js";import{C as x}from"./index.4aea64de.js";import"./index.bcc8eff6.js";import{L as N}from"./index.f904775d.js";import{o as w,g as P}from"./index.68f32c85.js";import{t as Y}from"./tradeOrder.d6463377.js";import{D as k}from"./index.27ea524d.js";import{u as A}from"./hooks.00b5b341.js";import"./use-id.f239f36f.js";import"./use-tab-status.e9ba8498.js";import"./use-refs.eb803454.js";import"./orderStatus.fea01d83.js";import"./utils.5fa3f1eb.js";import"./index.00bf6672.js";const O="_tradeRecord_k8m2o_1",F="_tab_k8m2o_11";var p={tradeRecord:O,tab:F};const R="_tradeList_ums1x_1",$="_searchTime_ums1x_1",B="_searchType_ums1x_2",E="_list_ums1x_14",M="_tradeLogo_ums1x_17",I="_tradeType_ums1x_24",z="_title_ums1x_27",j="_content_ums1x_28",V="_desc_ums1x_37",U="_num_ums1x_38",q="_btnList_ums1x_43";var a={tradeList:R,searchTime:$,searchType:B,list:E,tradeLogo:M,tradeType:I,title:z,content:j,desc:V,num:U,btnList:q};function G(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!b(e)}var m=f({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:l(this.currentDate).format("YYYY-MM")},s=this.type==="buy"?"/api-student/userOrder/page":"/api-student/userOrderRefunds/page",{code:r,data:y}=await n.post(s,{data:{...e,dateTime:this.type==="refund"?e.searchDate:void 0,timeType:this.type==="refund"?"MONTH":void 0}});if(r===200){const i=y||{};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){g.confirm({message:"\u662F\u5426\u53D6\u6D88\u8BA2\u5355\uFF1F",confirmButtonText:"\u786E\u5B9A",confirmButtonColor:"var(--van-primary)",cancelButtonText:"\u53D6\u6D88"}).then(async()=>{try{await n.post("/api-student/userOrder/orderCancel",{data:{orderNo:e.orderNo}}),this.onSearch()}catch{}})},async onPay(e){try{const r=(await n.get(`/api-student/userOrder/detailByOrderNo/${e.orderNo}`)).data;Y(r,()=>{this.$router.push({path:"/orderDetail",query:{orderType:r.orderType}})})}catch{}}},render(){let e;return t("div",{class:a.tradeList},[t(D,{position:"top",offsetTop:this.height},{default:()=>[t(u,{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(c,{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(c,{classPrefix:"iconfont",name:"down",size:12,color:"var(--van-primary)"},null)]):null})]}),this.dataShow?t(N,{loading:this.loading,finished:this.finished,finishedText:" ",class:[a.list],onLoad:this.getList},G(e=this.list.map(s=>t(x,{border:!1,onClick:()=>{this.onDetail(s)}},{default:()=>[t(u,{title:l(s.createTime).format("YYYY-MM-DD HH:mm"),value:this.type==="buy"?w[s.status]:s.operateReason,valueClass:a.tradeType},null),t(u,{border:!1},{title:()=>t("div",{class:a.title},[t("span",null,[s.orderName]),t("span",{class:a.desc},[P[s.orderType]])]),default:()=>t("div",{class:a.content},[t("span",{class:a.price},[o("\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(d,{size:"small",round:!0,onClick:r=>{r.stopPropagation(),this.onCancelPay(s)}},{default:()=>[o("\u53D6\u6D88\u8BA2\u5355")]}),t(d,{size:"small",round:!0,type:"primary",onClick:r=>{r.stopPropagation(),this.onPay(s)}},{default:()=>[o("\u7EE7\u7EED\u652F\u4ED8")]})]):null]})))?e:{default:()=>[e]}):t(_,{btnStatus:!1,classImgSize:"SMALL",tips:this.type==="buy"?"\u6682\u65E0\u8D2D\u4E70\u8BB0\u5F55":"\u6682\u65E0\u9000\u6B3E\u8BB0\u5F55"},null),t(T,{show:this.timeStatus,"onUpdate:show":s=>this.timeStatus=s,position:"bottom",round:!0,closeOnPopstate:!0},{default:()=>[t(k,{type:"year-month",modelValue:this.currentDate,"onUpdate:modelValue":s=>this.currentDate=s,formatter:S,onCancel:()=>{this.timeStatus=!1},onConfirm:this.onConfirm},null)]}),t(L,{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)])}}),ht=f({name:"tradeRecord",data(){return{active:"buy",height:44}},mounted(){this.$nextTick(()=>{const{height:e}=v(this.$refs.tabs);this.height=e}),A("\u4EA4\u6613\u8BB0\u5F55")},render(){return t("div",{class:p.tradeRecord},[t(C,{active:this.active,"onUpdate:active":e=>this.active=e,color:"var(--van-primary)",sticky:!0,lineWidth:28},{default:()=>[t(h,{name:"buy"},{default:()=>[t(m,{height:this.height},null)],title:()=>t("div",{class:p.tab,ref:"tabs"},[o("\u8D2D\u4E70\u8BB0\u5F55")])}),t(h,{name:"refund",title:"\u9000\u8D39\u8BB0\u5F55"},{default:()=>[t(m,{height:this.height,type:"refund"},null)]})]})])}});export{ht as default};
|