mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
4 lines
28 KiB
JavaScript
4 lines
28 KiB
JavaScript
import{r as n,c as K,q as vt,x as o,z as t,I as X,R as ft,L as d,O as v,P as l,K as p,al as kt,aq as C,Q as f,ac as M,aV as Y,a5 as Z,Y as ht,y as a,C as L,u as U}from"./vue-vendor-DV7DYXbz.js";import{C as wt}from"./ConfirmModal-C2rCOkXI.js";import{bo as Ct,bp as _t,bq as At,br as $t,bs as Ut,s as m,bt as et,bu as qt,bv as jt,Z as N,c as st}from"./index-BahP9Xx9.js";import"./element-plus-BSjV1f9S.js";import"./vendor-Dr8jvgFu.js";const Tt={class:"tab-content"},Vt={class:"card p-4 sm:p-6"},Mt={class:"mb-4 flex flex-col gap-4 sm:mb-6"},Lt={class:"flex items-center justify-between"},St={class:"grid grid-cols-2 gap-3 sm:grid-cols-4 sm:gap-4"},Dt={class:"stat-card"},Pt={class:"flex items-center justify-between"},Rt={class:"text-xl font-bold text-gray-900 dark:text-gray-100 sm:text-2xl"},Qt={class:"stat-card"},It={class:"flex items-center justify-between"},zt={class:"text-xl font-bold text-green-600 dark:text-green-400 sm:text-2xl"},Bt={class:"stat-card"},Kt={class:"flex items-center justify-between"},Nt={class:"text-xl font-bold text-purple-600 dark:text-purple-400 sm:text-2xl"},Ot={class:"stat-card"},Et={class:"flex items-center justify-between"},Ft={class:"text-xl font-bold text-red-600 dark:text-red-400 sm:text-2xl"},Wt={class:"rounded-lg border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/50"},Xt={class:"flex flex-wrap items-center gap-4"},Yt={class:"flex items-center gap-2"},Zt={class:"relative inline-flex cursor-pointer items-center"},Gt={class:"flex items-center gap-2"},Ht=["disabled"],Jt={class:"flex items-center gap-2"},te=["disabled"],ee={class:"border-b border-gray-200 dark:border-gray-700"},se={"aria-label":"Tabs",class:"-mb-px flex space-x-8"},ae=["onClick"],re={key:0,class:"flex items-center justify-center py-12"},oe={key:1,class:"overflow-x-auto"},le={key:0,class:"mb-3 flex items-center gap-3 rounded-lg bg-blue-50 p-3 dark:bg-blue-900/20"},de={class:"text-sm text-blue-700 dark:text-blue-300"},ne={class:"min-w-full divide-y divide-gray-200 dark:divide-gray-700"},ie={class:"bg-gray-50 dark:bg-gray-700/50"},ue={class:"w-10 px-4 py-3"},xe=["checked","indeterminate"],ge={class:"divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-800"},ye={class:"whitespace-nowrap px-4 py-3"},pe=["checked","onChange"],be={class:"whitespace-nowrap px-4 py-3"},me=["onClick"],ce={class:"whitespace-nowrap px-4 py-3"},ve={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-900 dark:text-white"},fe={key:0},ke={key:1},he={key:2},we={class:"whitespace-nowrap px-4 py-3"},Ce={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-500 dark:text-gray-400"},_e={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-500 dark:text-gray-400"},Ae={class:"whitespace-nowrap px-4 py-3 text-right"},$e=["onClick"],Ue={key:0},qe={key:1,class:"flex flex-col items-center justify-between gap-3 border-t border-gray-200 px-4 py-3 dark:border-gray-700 sm:flex-row"},je={class:"flex items-center gap-4"},Te={class:"text-sm text-gray-600 dark:text-gray-400"},Ve={class:"flex items-center gap-2"},Me=["value"],Le={class:"flex items-center gap-2"},Se=["disabled"],De={class:"text-sm text-gray-600 dark:text-gray-400"},Pe=["disabled"],Re={key:2,class:"overflow-x-auto"},Qe={class:"min-w-full divide-y divide-gray-200 dark:divide-gray-700"},Ie={class:"divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-800"},ze={class:"whitespace-nowrap px-4 py-3"},Be=["onClick"],Ke={class:"whitespace-nowrap px-4 py-3"},Ne=["onClick"],Oe={class:"whitespace-nowrap px-4 py-3"},Ee=["onClick"],Fe={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-900 dark:text-white"},We={key:0},Xe={key:1},Ye={key:2},Ze={class:"whitespace-nowrap px-4 py-3"},Ge={class:"whitespace-nowrap px-4 py-3 text-sm text-gray-500 dark:text-gray-400"},He={class:"whitespace-nowrap px-4 py-3 text-right"},Je=["onClick"],ts={key:0},es={key:0,class:"modal fixed inset-0 z-50 flex items-center justify-center p-4"},ss={class:"modal-content mx-auto w-full max-w-lg p-6"},as={class:"mb-6 flex items-center justify-between"},rs={class:"space-y-4"},os={key:0},ls={key:1},ds={class:"flex gap-2"},ns={class:"mt-6 flex gap-3"},is=["disabled"],us={key:0,class:"fas fa-spinner fa-spin mr-2"},xs={key:0,class:"modal fixed inset-0 z-50 flex items-center justify-center p-4"},gs={class:"modal-content mx-auto w-full max-w-lg p-6"},ys={class:"mb-6 flex items-center justify-between"},ps={class:"flex items-center gap-3"},bs={class:"text-sm text-gray-500 dark:text-gray-400"},ms={class:"mb-4 max-h-60 overflow-y-auto rounded-lg bg-gray-50 p-3 dark:bg-gray-700/50"},cs={class:"flex items-center gap-2"},vs={class:"text-xs text-gray-400"},fs={class:"font-mono text-sm text-gray-900 dark:text-white"},ks={class:"text-xs text-gray-500 dark:text-gray-400"},hs={class:"w-full max-w-md rounded-2xl bg-white p-6 shadow-2xl dark:bg-gray-800"},ws={class:"mb-4"},Cs={class:"flex justify-end gap-3"},Ts={__name:"QuotaCardsView",setup(_s){const O=n(!1),q=n(!1),j=n(!1),E=n(!1),S=n(!1),_=n({title:"",message:"",type:"primary",confirmText:"确认",cancelText:"取消"}),k=n(null),y=n([]),T=n(!1),D=n(""),P=n(null),R=n("cards"),i=n([]),c=n(1),V=n(20),at=[10,20,50,100],Q=n(0),rt=[{id:"cards",name:"卡片列表"},{id:"redemptions",name:"核销记录"}],A=n({total:0,unused:0,redeemed:0,revoked:0,expired:0}),b=n({enabled:!0,maxExpiryDays:90,maxTotalCostLimit:1e3}),I=n([]),F=n([]),z=K(()=>I.value.filter(r=>r.status==="unused")),G=K(()=>z.value.length>0&&i.value.length===z.value.length),ot=K(()=>i.value.length>0&&i.value.length<z.value.length),lt=()=>{G.value?i.value=[]:i.value=z.value.map(r=>r.id)},dt=r=>{const e=i.value.indexOf(r);e===-1?i.value.push(r):i.value.splice(e,1)},x=n({type:"quota",quotaAmount:10,timeAmount:30,timeUnit:"days",count:1,note:""}),H=(r,e,s="确认",u="取消",$="primary")=>new Promise(g=>{_.value={title:r,message:e,confirmText:s,cancelText:u,type:$},k.value=g,S.value=!0}),nt=()=>{var r;S.value=!1,(r=k.value)==null||r.call(k,!0)},it=()=>{var r;S.value=!1,(r=k.value)==null||r.call(k,!1)},h=async()=>{var g,w,B;O.value=!0;const r=(c.value-1)*V.value,[e,s,u]=await Promise.all([Ct({limit:V.value,offset:r}),_t(),At()]),$=await $t().catch(()=>({data:null}));I.value=((g=e.data)==null?void 0:g.cards)||[],Q.value=((w=e.data)==null?void 0:w.total)||0,A.value=s.data||A.value,F.value=((B=u.data)==null?void 0:B.redemptions)||[],$.data&&(b.value=$.data),O.value=!1},W=async()=>{(await Ut(b.value)).success&&m("配置已保存","success")},J=K(()=>Math.ceil(Q.value/V.value)),tt=r=>{c.value=r,i.value=[],h()},ut=()=>{c.value=1,i.value=[],h()},xt=async()=>{q.value=!0;const r=await qt(x.value);if(r.success){j.value=!1;const e=r.data;Array.isArray(e)?y.value=e:e?y.value=[e]:y.value=[],y.value.length>0&&(E.value=!0),m(`成功创建 ${y.value.length} 张卡片`,"success"),h()}else m(r.message||"创建卡片失败","error");q.value=!1},gt=()=>{if(y.value.length===0)return;const r=y.value.map(g=>{let w="";if((g.type==="quota"||g.type==="combo")&&(w+=`$${g.quotaAmount}`),g.type==="combo"&&(w+="_"),g.type==="time"||g.type==="combo"){const B={hours:"h",days:"d",months:"m"};w+=`${g.timeAmount}${B[g.timeUnit]||g.timeUnit}`}return`${w} ${g.code}`}).join(`
|
||
`),e=new Blob([r],{type:"text/plain;charset=utf-8"}),s=URL.createObjectURL(e),u=document.createElement("a");u.href=s;const $=new Date().toISOString().replace(/[:.]/g,"-").slice(0,-5);u.download=`quota-cards-${$}.txt`,document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(s),m("卡片文件已下载","success")},yt=async()=>{if(y.value.length===0)return;const r=y.value.map(e=>e.code).join(`
|
||
`);try{await navigator.clipboard.writeText(r),m("已复制所有卡号","success")}catch(e){console.error("Failed to copy:",e),m("复制失败","error")}},pt=async r=>{await H("删除卡片",`确定删除卡片 ${r.code}?`,"确定删除","取消","danger")&&(await et(r.id),m("卡片已删除","success"),h())},bt=async()=>{await H("批量删除",`确定删除选中的 ${i.value.length} 张卡片?`,"确定删除","取消","danger")&&(await Promise.all(i.value.map(e=>et(e))),m(`已删除 ${i.value.length} 张卡片`,"success"),i.value=[],h())},mt=r=>{P.value=r,D.value="",T.value=!0},ct=async()=>{P.value&&(await jt(P.value.id,{reason:D.value}),m("核销已撤销","success"),T.value=!1,P.value=null,h())};return vt(()=>{h()}),(r,e)=>(a(),o("div",Tt,[t("div",Vt,[t("div",Mt,[t("div",Lt,[e[21]||(e[21]=t("div",null,[t("h3",{class:"mb-1 text-lg font-bold text-gray-900 dark:text-gray-100 sm:mb-2 sm:text-xl"}," 额度卡管理 "),t("p",{class:"text-sm text-gray-600 dark:text-gray-400 sm:text-base"}," 管理额度卡和时间卡,用户可核销增加额度 ")],-1)),t("button",{class:"inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",onClick:e[0]||(e[0]=s=>j.value=!0)},e[20]||(e[20]=[t("i",{class:"fas fa-plus mr-2"},null,-1),v(" 创建卡片 ",-1)]))]),t("div",St,[t("div",Dt,[t("div",Pt,[t("div",null,[e[22]||(e[22]=t("p",{class:"mb-1 text-xs font-semibold text-gray-600 dark:text-gray-400 sm:text-sm"}," 总卡片数 ",-1)),t("p",Rt,l(A.value.total),1)]),e[23]||(e[23]=t("div",{class:"stat-icon flex-shrink-0 bg-gradient-to-br from-blue-500 to-blue-600"},[t("i",{class:"fas fa-ticket-alt"})],-1))])]),t("div",Qt,[t("div",It,[t("div",null,[e[24]||(e[24]=t("p",{class:"mb-1 text-xs font-semibold text-gray-600 dark:text-gray-400 sm:text-sm"}," 未使用 ",-1)),t("p",zt,l(A.value.unused),1)]),e[25]||(e[25]=t("div",{class:"stat-icon flex-shrink-0 bg-gradient-to-br from-green-500 to-green-600"},[t("i",{class:"fas fa-check-circle"})],-1))])]),t("div",Bt,[t("div",Kt,[t("div",null,[e[26]||(e[26]=t("p",{class:"mb-1 text-xs font-semibold text-gray-600 dark:text-gray-400 sm:text-sm"}," 已核销 ",-1)),t("p",Nt,l(A.value.redeemed),1)]),e[27]||(e[27]=t("div",{class:"stat-icon flex-shrink-0 bg-gradient-to-br from-purple-500 to-purple-600"},[t("i",{class:"fas fa-exchange-alt"})],-1))])]),t("div",Ot,[t("div",Et,[t("div",null,[e[28]||(e[28]=t("p",{class:"mb-1 text-xs font-semibold text-gray-600 dark:text-gray-400 sm:text-sm"}," 已撤销 ",-1)),t("p",Ft,l(A.value.revoked),1)]),e[29]||(e[29]=t("div",{class:"stat-icon flex-shrink-0 bg-gradient-to-br from-red-500 to-red-600"},[t("i",{class:"fas fa-ban"})],-1))])])]),t("div",Wt,[t("div",Xt,[t("div",Yt,[e[31]||(e[31]=t("span",{class:"text-sm font-medium text-gray-700 dark:text-gray-300"},"兑换上限保护",-1)),t("label",Zt,[p(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>b.value.enabled=s),class:"peer sr-only",type:"checkbox",onChange:W},null,544),[[kt,b.value.enabled]]),e[30]||(e[30]=t("div",{class:"peer h-5 w-9 rounded-full bg-gray-300 after:absolute after:left-[2px] after:top-[2px] after:h-4 after:w-4 after:rounded-full after:bg-white after:transition-all after:content-[''] peer-checked:bg-blue-600 peer-checked:after:translate-x-full dark:bg-gray-600"},null,-1))])]),t("div",Gt,[e[32]||(e[32]=t("span",{class:"text-sm text-gray-600 dark:text-gray-400"},"最大额度",-1)),p(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>b.value.maxTotalCostLimit=s),class:"w-24 rounded border border-gray-300 bg-white px-2 py-1 text-sm dark:border-gray-600 dark:bg-gray-700 dark:text-white",disabled:!b.value.enabled,min:"0",type:"number",onChange:W},null,40,Ht),[[C,b.value.maxTotalCostLimit,void 0,{number:!0}]]),e[33]||(e[33]=t("span",{class:"text-sm text-gray-500 dark:text-gray-400"},"$",-1))]),t("div",Jt,[e[34]||(e[34]=t("span",{class:"text-sm text-gray-600 dark:text-gray-400"},"最大有效期",-1)),p(t("input",{"onUpdate:modelValue":e[3]||(e[3]=s=>b.value.maxExpiryDays=s),class:"w-20 rounded border border-gray-300 bg-white px-2 py-1 text-sm dark:border-gray-600 dark:bg-gray-700 dark:text-white",disabled:!b.value.enabled,min:"0",type:"number",onChange:W},null,40,te),[[C,b.value.maxExpiryDays,void 0,{number:!0}]]),e[35]||(e[35]=t("span",{class:"text-sm text-gray-500 dark:text-gray-400"},"天",-1))])])]),t("div",ee,[t("nav",se,[(a(),o(f,null,M(rt,s=>t("button",{key:s.id,class:L(["whitespace-nowrap border-b-2 px-1 py-2 text-sm font-medium",R.value===s.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-gray-500 dark:hover:text-gray-300"]),onClick:u=>R.value=s.id},l(s.name),11,ae)),64))])])]),O.value?(a(),o("div",re,e[36]||(e[36]=[t("i",{class:"fas fa-spinner fa-spin mr-2 text-blue-500"},null,-1),t("span",{class:"text-gray-500 dark:text-gray-400"},"加载中...",-1)]))):R.value==="cards"?(a(),o("div",oe,[i.value.length>0?(a(),o("div",le,[t("span",de," 已选择 "+l(i.value.length)+" 张卡片 ",1),t("button",{class:"rounded-lg bg-red-500 px-3 py-1.5 text-sm font-medium text-white hover:bg-red-600",onClick:bt},e[37]||(e[37]=[t("i",{class:"fas fa-trash mr-1"},null,-1),v(" 批量删除 ",-1)])),t("button",{class:"rounded-lg bg-gray-200 px-3 py-1.5 text-sm font-medium text-gray-700 hover:bg-gray-300 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600",onClick:e[4]||(e[4]=s=>i.value=[])}," 取消选择 ")])):d("",!0),t("table",ne,[t("thead",ie,[t("tr",null,[t("th",ue,[t("input",{checked:G.value,class:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700",indeterminate:ot.value,type:"checkbox",onChange:lt},null,40,xe)]),e[38]||(e[38]=t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 卡号 ",-1)),e[39]||(e[39]=t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 类型 ",-1)),e[40]||(e[40]=t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 额度/时间 ",-1)),e[41]||(e[41]=t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 状态 ",-1)),e[42]||(e[42]=t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 核销用户 ",-1)),e[43]||(e[43]=t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 创建时间 ",-1)),e[44]||(e[44]=t("th",{class:"px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 操作 ",-1))])]),t("tbody",ge,[(a(!0),o(f,null,M(I.value,s=>(a(),o("tr",{key:s.id,class:L(["hover:bg-gray-50 dark:hover:bg-gray-700/50",i.value.includes(s.id)?"bg-blue-50 dark:bg-blue-900/10":""])},[t("td",ye,[s.status==="unused"?(a(),o("input",{key:0,checked:i.value.includes(s.id),class:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700",type:"checkbox",onChange:u=>dt(s.id)},null,40,pe)):d("",!0)]),t("td",be,[t("code",{class:"cursor-pointer rounded bg-gray-100 px-2 py-1 font-mono text-xs hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",title:"点击复制",onClick:u=>U(N)(s.code)},l(s.code),9,me)]),t("td",ce,[t("span",{class:L(["inline-flex rounded-full px-2 py-1 text-xs font-medium",s.type==="quota"?"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300":s.type==="time"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300":"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300"])},l(s.type==="quota"?"额度卡":s.type==="time"?"时间卡":"组合卡"),3)]),t("td",ve,[s.type==="quota"||s.type==="combo"?(a(),o("span",fe,"$"+l(s.quotaAmount),1)):d("",!0),s.type==="combo"?(a(),o("span",ke," + ")):d("",!0),s.type==="time"||s.type==="combo"?(a(),o("span",he,l(s.timeAmount)+" "+l(s.timeUnit==="hours"?"小时":s.timeUnit==="days"?"天":"月"),1)):d("",!0)]),t("td",we,[t("span",{class:L(["inline-flex rounded-full px-2 py-1 text-xs font-medium",s.status==="unused"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300":s.status==="redeemed"?"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300":"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300"])},l(s.status==="unused"?"未使用":s.status==="redeemed"?"已核销":"已撤销"),3)]),t("td",Ce,l(s.redeemedByUsername||"-"),1),t("td",_e,l(U(st)(s.createdAt)),1),t("td",Ae,[s.status==="unused"?(a(),o("button",{key:0,class:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"删除",onClick:u=>pt(s)},e[45]||(e[45]=[t("i",{class:"fas fa-trash"},null,-1)]),8,$e)):d("",!0)])],2))),128)),I.value.length===0?(a(),o("tr",Ue,e[46]||(e[46]=[t("td",{class:"px-4 py-8 text-center text-sm text-gray-500 dark:text-gray-400",colspan:"8"}," 暂无卡片数据 ",-1)]))):d("",!0)])]),Q.value>0?(a(),o("div",qe,[t("div",je,[t("span",Te," 共 "+l(Q.value)+" 条记录 ",1),t("div",Ve,[e[47]||(e[47]=t("span",{class:"text-sm text-gray-600 dark:text-gray-400"},"每页",-1)),p(t("select",{"onUpdate:modelValue":e[5]||(e[5]=s=>V.value=s),class:"rounded-md border border-gray-200 bg-white px-2 py-1 text-sm text-gray-700 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300",onChange:ut},[(a(),o(f,null,M(at,s=>t("option",{key:s,value:s},l(s),9,Me)),64))],544),[[Y,V.value]]),e[48]||(e[48]=t("span",{class:"text-sm text-gray-600 dark:text-gray-400"},"条",-1))])]),t("div",Le,[t("button",{class:"rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700",disabled:c.value===1,onClick:e[6]||(e[6]=s=>tt(c.value-1))},e[49]||(e[49]=[t("i",{class:"fas fa-chevron-left"},null,-1)]),8,Se),t("span",De,l(c.value)+" / "+l(J.value),1),t("button",{class:"rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700",disabled:c.value>=J.value,onClick:e[7]||(e[7]=s=>tt(c.value+1))},e[50]||(e[50]=[t("i",{class:"fas fa-chevron-right"},null,-1)]),8,Pe)])])):d("",!0)])):R.value==="redemptions"?(a(),o("div",Re,[t("table",Qe,[e[53]||(e[53]=t("thead",{class:"bg-gray-50 dark:bg-gray-700/50"},[t("tr",null,[t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 卡号 "),t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 用户 "),t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," API Key "),t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 增加额度 "),t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 状态 "),t("th",{class:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 核销时间 "),t("th",{class:"px-4 py-3 text-right text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-300"}," 操作 ")])],-1)),t("tbody",Ie,[(a(!0),o(f,null,M(F.value,s=>(a(),o("tr",{key:s.id,class:"hover:bg-gray-50 dark:hover:bg-gray-700/50"},[t("td",ze,[t("code",{class:"cursor-pointer rounded bg-gray-100 px-2 py-1 font-mono text-xs hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",title:"点击复制",onClick:u=>U(N)(s.cardCode)},l(s.cardCode),9,Be)]),t("td",Ke,[t("span",{class:"cursor-pointer text-sm text-gray-900 hover:text-blue-600 dark:text-white dark:hover:text-blue-400",title:"点击复制",onClick:u=>U(N)(s.username||s.userId)},l(s.username||s.userId),9,Ne)]),t("td",Oe,[t("span",{class:"cursor-pointer text-sm text-gray-500 hover:text-blue-600 dark:text-gray-400 dark:hover:text-blue-400",title:"点击复制",onClick:u=>U(N)(s.apiKeyName||s.apiKeyId)},l(s.apiKeyName||s.apiKeyId),9,Ee)]),t("td",Fe,[s.quotaAdded>0?(a(),o("span",We,"$"+l(s.quotaAdded),1)):d("",!0),s.quotaAdded>0&&s.timeAdded>0?(a(),o("span",Xe," + ")):d("",!0),s.timeAdded>0?(a(),o("span",Ye,l(s.timeAdded)+" "+l(s.timeUnit==="hours"?"小时":s.timeUnit==="days"?"天":"月"),1)):d("",!0)]),t("td",Ze,[t("span",{class:L(["inline-flex rounded-full px-2 py-1 text-xs font-medium",s.status==="active"?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300":"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300"])},l(s.status==="active"?"有效":"已撤销"),3)]),t("td",Ge,l(U(st)(s.timestamp)),1),t("td",He,[s.status==="active"?(a(),o("button",{key:0,class:"text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300",title:"撤销核销",onClick:u=>mt(s)},e[51]||(e[51]=[t("i",{class:"fas fa-undo"},null,-1)]),8,Je)):d("",!0)])]))),128)),F.value.length===0?(a(),o("tr",ts,e[52]||(e[52]=[t("td",{class:"px-4 py-8 text-center text-sm text-gray-500 dark:text-gray-400",colspan:"7"}," 暂无核销记录 ",-1)]))):d("",!0)])])])):d("",!0)]),(a(),X(Z,{to:"body"},[j.value?(a(),o("div",es,[t("div",ss,[t("div",as,[e[55]||(e[55]=t("div",{class:"flex items-center gap-3"},[t("div",{class:"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-blue-500 to-blue-600"},[t("i",{class:"fas fa-ticket-alt text-white"})]),t("h3",{class:"text-lg font-bold text-gray-900 dark:text-gray-100"},"创建额度卡")],-1)),t("button",{class:"p-1 text-gray-400 transition-colors hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",onClick:e[8]||(e[8]=s=>j.value=!1)},e[54]||(e[54]=[t("i",{class:"fas fa-times text-xl"},null,-1)]))]),t("div",rs,[t("div",null,[e[57]||(e[57]=t("label",{class:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300"},"卡片类型",-1)),p(t("select",{"onUpdate:modelValue":e[9]||(e[9]=s=>x.value.type=s),class:"block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white"},e[56]||(e[56]=[t("option",{value:"quota"},"额度卡",-1),t("option",{value:"time"},"时间卡",-1),t("option",{value:"combo"},"组合卡",-1)]),512),[[Y,x.value.type]])]),x.value.type==="quota"||x.value.type==="combo"?(a(),o("div",os,[e[58]||(e[58]=t("label",{class:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300"},"额度数量 (美元)",-1)),p(t("input",{"onUpdate:modelValue":e[10]||(e[10]=s=>x.value.quotaAmount=s),class:"block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white",min:"0",step:"0.1",type:"number"},null,512),[[C,x.value.quotaAmount,void 0,{number:!0}]])])):d("",!0),x.value.type==="time"||x.value.type==="combo"?(a(),o("div",ls,[e[60]||(e[60]=t("label",{class:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300"},"时间数量",-1)),t("div",ds,[p(t("input",{"onUpdate:modelValue":e[11]||(e[11]=s=>x.value.timeAmount=s),class:"block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white",min:"1",type:"number"},null,512),[[C,x.value.timeAmount,void 0,{number:!0}]]),p(t("select",{"onUpdate:modelValue":e[12]||(e[12]=s=>x.value.timeUnit=s),class:"block rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white"},e[59]||(e[59]=[t("option",{value:"hours"},"小时",-1),t("option",{value:"days"},"天",-1),t("option",{value:"months"},"月",-1)]),512),[[Y,x.value.timeUnit]])])])):d("",!0),t("div",null,[e[61]||(e[61]=t("label",{class:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300"},"批量生成数量",-1)),p(t("input",{"onUpdate:modelValue":e[13]||(e[13]=s=>x.value.count=s),class:"block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white",max:"100",min:"1",type:"number"},null,512),[[C,x.value.count,void 0,{number:!0}]])]),t("div",null,[e[62]||(e[62]=t("label",{class:"mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300"},"备注(可选)",-1)),p(t("input",{"onUpdate:modelValue":e[14]||(e[14]=s=>x.value.note=s),class:"block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white",placeholder:"例如:新年促销卡",type:"text"},null,512),[[C,x.value.note]])])]),t("div",ns,[t("button",{class:"flex-1 rounded-xl bg-gray-100 px-4 py-2.5 font-medium text-gray-700 transition-colors hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600",type:"button",onClick:e[15]||(e[15]=s=>j.value=!1)}," 取消 "),t("button",{class:"flex-1 rounded-xl bg-gradient-to-r from-blue-500 to-blue-600 px-4 py-2.5 font-medium text-white shadow-sm transition-colors hover:from-blue-600 hover:to-blue-700 disabled:opacity-50",disabled:q.value,type:"button",onClick:xt},[q.value?(a(),o("i",us)):d("",!0),v(" "+l(q.value?"创建中...":"创建"),1)],8,is)])])])):d("",!0)])),(a(),X(Z,{to:"body"},[E.value?(a(),o("div",xs,[t("div",gs,[t("div",ys,[t("div",ps,[e[64]||(e[64]=t("div",{class:"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-green-500 to-green-600"},[t("i",{class:"fas fa-check text-white"})],-1)),t("div",null,[e[63]||(e[63]=t("h3",{class:"text-lg font-bold text-gray-900 dark:text-gray-100"},"创建成功",-1)),t("p",bs," 已创建 "+l(y.value.length)+" 张卡片 ",1)])]),t("button",{class:"p-1 text-gray-400 transition-colors hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300",onClick:e[16]||(e[16]=s=>E.value=!1)},e[65]||(e[65]=[t("i",{class:"fas fa-times text-xl"},null,-1)]))]),t("div",ms,[(a(!0),o(f,null,M(y.value,(s,u)=>(a(),o("div",{key:s.id,class:"flex items-center justify-between border-b border-gray-200 py-2 last:border-0 dark:border-gray-600"},[t("div",cs,[t("span",vs,l(u+1)+".",1),t("code",fs,l(s.code),1)]),t("span",ks,[s.type==="quota"||s.type==="combo"?(a(),o(f,{key:0},[v(" $"+l(s.quotaAmount),1)],64)):d("",!0),s.type==="combo"?(a(),o(f,{key:1},[v(" + ")],64)):d("",!0),s.type==="time"||s.type==="combo"?(a(),o(f,{key:2},[v(l(s.timeAmount)+" "+l(s.timeUnit==="hours"?"小时":s.timeUnit==="days"?"天":"月"),1)],64)):d("",!0)])]))),128))]),e[68]||(e[68]=t("div",{class:"mb-4 rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-700 dark:bg-yellow-900/20"},[t("div",{class:"flex items-start gap-2"},[t("i",{class:"fas fa-exclamation-triangle mt-0.5 text-yellow-500"}),t("p",{class:"text-sm text-yellow-700 dark:text-yellow-300"}," 请立即下载或复制卡号,关闭后将无法再次查看完整卡号列表。 ")])],-1)),t("div",{class:"flex gap-3"},[t("button",{class:"flex-1 rounded-xl bg-gradient-to-r from-blue-500 to-blue-600 px-4 py-2.5 font-medium text-white shadow-sm transition-colors hover:from-blue-600 hover:to-blue-700",type:"button",onClick:gt},e[66]||(e[66]=[t("i",{class:"fas fa-download mr-2"},null,-1),v(" 下载 TXT ",-1)])),t("button",{class:"flex-1 rounded-xl bg-gray-100 px-4 py-2.5 font-medium text-gray-700 transition-colors hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600",type:"button",onClick:yt},e[67]||(e[67]=[t("i",{class:"fas fa-copy mr-2"},null,-1),v(" 复制全部 ",-1)]))])])])):d("",!0)])),(a(),X(Z,{to:"body"},[T.value?(a(),o("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4 backdrop-blur-sm",onClick:e[19]||(e[19]=ht(s=>T.value=!1,["self"]))},[t("div",hs,[e[70]||(e[70]=t("h3",{class:"mb-4 text-lg font-semibold text-gray-900 dark:text-white"},"撤销核销",-1)),t("div",ws,[e[69]||(e[69]=t("label",{class:"mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300"}," 撤销原因(可选) ",-1)),p(t("input",{"onUpdate:modelValue":e[17]||(e[17]=s=>D.value=s),class:"w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white",placeholder:"请输入撤销原因",type:"text"},null,512),[[C,D.value]])]),t("div",Cs,[t("button",{class:"rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600",onClick:e[18]||(e[18]=s=>T.value=!1)}," 取消 "),t("button",{class:"rounded-lg bg-red-500 px-4 py-2 text-sm font-medium text-white hover:bg-red-600",onClick:ct}," 确认撤销 ")])])])):d("",!0)])),ft(wt,{"cancel-text":_.value.cancelText,"confirm-text":_.value.confirmText,message:_.value.message,show:S.value,title:_.value.title,type:_.value.type,onCancel:it,onConfirm:nt},null,8,["cancel-text","confirm-text","message","show","title","type"])]))}};export{Ts as default};
|