import{d as M,r as v,a as I,o as O,g as o,J as G,c as V,k as g,e as t,w as a,K as H,f as k,F as Q,y as W,l as b,z as D,t as _,O as X,s as Y,b as u,x as c,_ as Z}from"./index-CUnFTKV2.js";import{h as N,i as $,j as y}from"./coupon-C54tWHNa.js";const ee={class:"page-container"},te={class:"user-info"},ae={class:"uid"},le={class:"nickname"},ne={class:"money"},se={class:"discount"},oe=M({__name:"receive",setup(ie){const f=v(!1),z=v([]),S=v(0),n=I({userId:"",title:"",status:void 0}),i=I({page:1,pageSize:20}),p=async()=>{f.value=!0;try{const s={page:i.page,pageSize:i.pageSize};n.userId&&(s.userId=Number(n.userId)),n.title&&(s.title=n.title),n.status!==void 0&&(s.status=n.status);const l=await $(s);z.value=l.data.list,S.value=l.data.total}finally{f.value=!1}},h=()=>{i.page=1,p()},U=()=>{n.userId="",n.title="",n.status=void 0,i.page=1,p()},F=s=>{i.page=s,p()},P=s=>{i.pageSize=s,i.page=1,p()},T=s=>N[s]||"未知",B=s=>{switch(s){case y.Unused:return"success";case y.Used:return"info";case y.Expired:return"danger";default:return""}};return O(()=>{p()}),(s,l)=>{const w=o("el-input"),m=o("el-form-item"),K=o("el-option"),R=o("el-select"),x=o("el-icon"),C=o("el-button"),L=o("el-form"),r=o("el-table-column"),j=o("el-tag"),E=o("el-table"),q=o("el-pagination"),A=o("el-card"),J=G("loading");return g(),V("div",ee,[t(A,null,{header:a(()=>[...l[5]||(l[5]=[u("div",{class:"card-header"},[u("span",null,"优惠券领取记录")],-1)])]),default:a(()=>[t(L,{inline:!0,model:n,class:"search-form"},{default:a(()=>[t(m,{label:"用户ID"},{default:a(()=>[t(w,{modelValue:n.userId,"onUpdate:modelValue":l[0]||(l[0]=e=>n.userId=e),placeholder:"请输入用户ID",clearable:"",onKeyup:k(h,["enter"]),style:{width:"140px"}},null,8,["modelValue"])]),_:1}),t(m,{label:"优惠券标题"},{default:a(()=>[t(w,{modelValue:n.title,"onUpdate:modelValue":l[1]||(l[1]=e=>n.title=e),placeholder:"请输入优惠券标题",clearable:"",onKeyup:k(h,["enter"]),style:{width:"180px"}},null,8,["modelValue"])]),_:1}),t(m,{label:"状态"},{default:a(()=>[t(R,{modelValue:n.status,"onUpdate:modelValue":l[2]||(l[2]=e=>n.status=e),placeholder:"全部状态",clearable:"",style:{width:"120px"}},{default:a(()=>[(g(!0),V(Q,null,W(b(N),(e,d)=>(g(),D(K,{key:d,label:e,value:Number(d)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(m,null,{default:a(()=>[t(C,{type:"primary",onClick:h},{default:a(()=>[t(x,null,{default:a(()=>[t(b(X))]),_:1}),l[6]||(l[6]=_("查询 ",-1))]),_:1}),t(C,{onClick:U},{default:a(()=>[t(x,null,{default:a(()=>[t(b(Y))]),_:1}),l[7]||(l[7]=_("重置 ",-1))]),_:1})]),_:1})]),_:1},8,["model"]),H((g(),D(E,{data:z.value,border:"",stripe:""},{default:a(()=>[t(r,{prop:"id",label:"ID",width:"80",align:"center"}),t(r,{label:"用户信息","min-width":"150"},{default:a(({row:e})=>[u("div",te,[u("span",ae,"用户ID: "+c(e.userId),1),u("span",le,c(e.nickname||"-"),1)])]),_:1}),t(r,{prop:"couponTitle",label:"优惠券名称","min-width":"150"}),t(r,{label:"满减门槛",width:"100",align:"right"},{default:a(({row:e})=>{var d;return[u("span",ne,"¥"+c(((d=e.minPrice)==null?void 0:d.toFixed(2))||"0.00"),1)]}),_:1}),t(r,{label:"优惠金额",width:"100",align:"right"},{default:a(({row:e})=>{var d;return[u("span",se,"¥"+c(((d=e.discountPrice)==null?void 0:d.toFixed(2))||"0.00"),1)]}),_:1}),t(r,{label:"状态",width:"100",align:"center"},{default:a(({row:e})=>[t(j,{type:B(e.status),size:"small"},{default:a(()=>[_(c(e.statusName||T(e.status)),1)]),_:2},1032,["type"])]),_:1}),t(r,{label:"过期时间",width:"160",align:"center"},{default:a(({row:e})=>[_(c(e.expireTime||"-"),1)]),_:1}),t(r,{label:"领取时间",width:"160",align:"center"},{default:a(({row:e})=>[_(c(e.createdAt||"-"),1)]),_:1})]),_:1},8,["data"])),[[J,f.value]]),t(q,{"current-page":i.page,"onUpdate:currentPage":l[3]||(l[3]=e=>i.page=e),"page-size":i.pageSize,"onUpdate:pageSize":l[4]||(l[4]=e=>i.pageSize=e),"page-sizes":[10,20,50,100],total:S.value,layout:"total, sizes, prev, pager, next, jumper",onSizeChange:P,onCurrentChange:F,class:"pagination"},null,8,["current-page","page-size","total"])]),_:1})])}}}),ue=Z(oe,[["__scopeId","data-v-dad0ede2"]]);export{ue as default};
