index.083f3af6.js 2.3 KB

1
  1. import{d as n,g as r,j as t,C as p,F as d,Z as h,w as m}from"./index.394decd7.js";import{b as c,u as f}from"./hooks.9e5ee122.js";import"./index.3bbf4ddb.js";import"./index.f1b52763.js";import{T as S,a as o}from"./index.ae00317c.js";import{s as u,I as g}from"./item.2362e6e9.js";import{L}from"./index.dc786267.js";import{C as y}from"./index.e6e212d8.js";import{T as C}from"./index.88270f6d.js";import"./use-id.e2f22365.js";import"./use-tab-status.723110ee.js";import"./use-refs.09b2d19c.js";import"./index.75a0444f.js";import"./index.b9aedd1d.js";function T(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!h(s)}var l=n({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 s=await c(`${r.platformApi}/couponInfo/page`,{params:this.params,list:this.list,...this.listState}),{params:e,list:i,...a}=s;this.params=e,this.list=i,this.listState=a}catch{}}},render(){let s;return t(d,null,[this.listState.dataShow?t(L,{loading:this.listState.loading,"onUpdate:loading":e=>this.listState.loading=e,finished:this.listState.finished,finishedText:" ",class:[this.list.length>0&&u.list],onLoad:this.getList,immediateCheck:!1},T(s=this.list.map(e=>t(g,{item:e},null)))?s:{default:()=>[s]}):t(p,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u4F18\u60E0\u5238"},null)])}}),N=n({name:"coupon-container",data(){return{couponCount:{total:0,useState:"USABLE"},height:"auto"}},async mounted(){try{const s=r.platformType==="STUDENT"?"/api-student":"/api-teacher",i=(await m.get(`${s}/couponInfo/statInfo`)).data||[];this.couponCount=i.find(a=>a.useState==="USABLE"),console.log(i.find(a=>a.useState==="USABLE"))}catch{}f("\u4F18\u60E0\u5238")},render(){return t("div",{class:u.coupons},[t(C,{position:"top",onBarHeight:s=>{this.height=s}},{default:()=>[t(y,{isFixed:!1},null)]}),t(S,{color:"#2DC7AA",lineWidth:44,sticky:!0,offsetTop:this.height},{default:()=>[t(o,{title:`\u53EF\u4F7F\u7528${this.couponCount.total>0?"("+this.couponCount.total+"\u5F20)":""}`},{default:()=>[t(l,null,null)]}),t(o,{title:"\u5DF2\u4F7F\u7528"},{default:()=>[t(l,{useState:"USED"},null)]}),t(o,{title:"\u5DF2\u5931\u6548"},{default:()=>[t(l,{useState:"EXPIRED"},null)]})]})])}});export{N as default};