index.83f009f4.js 2.1 KB

1
  1. import{b as p,u as d}from"./hooks.ad006126.js";import{d as l,s as r,i as t,C as c,F as m,$ as f,e as h}from"./index.6b776f4b.js";import"./index.998c3386.js";import"./index.570314c1.js";import{T as S,a as o}from"./index.21339447.js";import{s as u,I as g}from"./item.1c6f4cf0.js";import{L}from"./index.9b1da5d2.js";import"./use-id.40b6af6b.js";import"./use-tab-status.ad41a764.js";import"./use-refs.a68d4385.js";function y(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!f(s)}var n=l({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 p(`${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(m,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},y(s=this.list.map(e=>t(g,{item:e},null)))?s:{default:()=>[s]}):t(c,{btnStatus:!1,classImgSize:"SMALL",tips:"\u6682\u65E0\u4F18\u60E0\u5238"},null)])}}),B=l({name:"coupon-container",data(){return{couponCount:{total:0,useState:"USABLE"}}},async mounted(){try{const s=r.platformType==="STUDENT"?"/api-student":"/api-teacher",i=(await h.get(`${s}/couponInfo/statInfo`)).data||[];this.couponCount=i.find(a=>a.useState==="USABLE"),console.log(i.find(a=>a.useState==="USABLE"))}catch{}d("\u4F18\u60E0\u5238")},render(){return t("div",{class:u.coupons},[t(S,{color:"#2DC7AA",lineWidth:44,sticky:!0},{default:()=>[t(o,{title:`\u53EF\u4F7F\u7528${this.couponCount.total>0?"("+this.couponCount.total+"\u5F20)":""}`},{default:()=>[t(n,null,null)]}),t(o,{title:"\u5DF2\u4F7F\u7528"},{default:()=>[t(n,{useState:"USED"},null)]}),t(o,{title:"\u5DF2\u5931\u6548"},{default:()=>[t(n,{useState:"EXPIRED"},null)]})]})])}});export{B as default};