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