var g=Object.defineProperty;var o=Object.getOwnPropertySymbols;var r=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable;var d=(t,s,e)=>s in t?g(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e,c=(t,s)=>{for(var e in s||(s={}))r.call(s,e)&&d(t,e,s[e]);if(o)for(var e of o(s))u.call(s,e)&&d(t,e,s[e]);return t};var p=(t,s)=>{var e={};for(var a in t)r.call(t,a)&&s.indexOf(a)<0&&(e[a]=t[a]);if(t!=null&&o)for(var a of o(t))s.indexOf(a)<0&&u.call(t,a)&&(e[a]=t[a]);return e};import{s as m,C as L,r as j}from"./index.a9c80450.js";import{d as h,a as i,M as y,x,F as C,v as b,w as n}from"./vendor.cd162bf7.js";/* empty css               *//* empty css              *//* empty css               */import{s as f,I as A}from"./item.08c576cb.js";import{a as E}from"./hooks.9d08351a.js";/* empty css               */function I(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!x(t)}var l=h({name:"coupon-list",props:{useState:{type:String,default:"USABLE"}},data(){return{list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{useState:this.useState,page:1,rows:20}}},mounted(){this.getList()},methods:{async getList(){try{const t=await E(`${m.platformApi}/couponInfo/page`,c({params:this.params,list:this.list},this.listState)),{params:e,list:a}=t,S=p(t,["params","list"]);this.params=e,this.list=a,this.listState=S}catch{}}},render(){let t;return i(C,null,[this.listState.dataShow?i(y,{loading:this.listState.loading,"onUpdate:loading":s=>this.listState.loading=s,finished:this.listState.finished,finishedText:" ",class:[this.list.length>0&&f.list],onLoad:this.getList,immediateCheck:!1},I(t=this.list.map(s=>i(A,{item:s},null)))?t:{default:()=>[t]}):i(L,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u4F18\u60E0\u5238"},null)])}}),F=h({name:"coupon-container",data(){return{couponCount:{total:0,useState:"USABLE"}}},async mounted(){try{const t=m.platformType==="STUDENT"?"/api-student":"/api-teacher",e=(await j.get(`${t}/couponInfo/statInfo`)).data||[];this.couponCount=e.find(a=>a.useState==="USABLE"),console.log(e.find(a=>a.useState==="USABLE"))}catch{}},render(){return i("div",{class:f.coupons},[i(b,{color:"#2DC7AA",lineWidth:44,sticky:!0,animated:!0},{default:()=>[i(n,{title:`\u53EF\u4F7F\u7528${this.couponCount.total>0?"("+this.couponCount.total+"\u5F20)":""}`},{default:()=>[i(l,null,null)]}),i(n,{title:"\u5DF2\u4F7F\u7528"},{default:()=>[i(l,{useState:"USED"},null)]}),i(n,{title:"\u5DF2\u5931\u6548"},{default:()=>[i(l,{useState:"EXPIRED"},null)]})]})])}});export{F as default};
