You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
4.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import{n as e}from"./axios-CiYFffbI.js";import{I as t,N as n,V as r,Y as i,_ as a,d as o,it as s,kt as c,nt as l,p as u,ut as d,v as f,y as p}from"./runtime-core.esm-bundler-CnFWH3R5.js";import{n as m}from"./http-LCi9aT1G.js";import{t as h}from"./listTableRowIndex-IQDARgc9.js";import{t as g}from"./datetime-yJWaAvAa.js";var _=[`src`],v={key:1},y=p({__name:`WechatUsers`,setup(p){let y=s(!1),b=s(!1),x=s([]),S=l({current:1,pageSize:15,total:0}),C=s(``),w=s(``),T=s(``);function E(e){return e?.length?e.map(e=>`${e.title}${e.status_label}`).join(``):``}async function D(){y.value=!0;try{let{data:e}=await m.get(`/wechat-users`,{params:{page:S.current,page_size:S.pageSize,keyword:C.value.trim()||void 0,has_activity_reservation:w.value===``?void 0:w.value===`1`,has_ticket_grab_reservation:T.value===``?void 0:T.value===`1`}});x.value=e.data??[],S.total=e.total??0}catch(t){e.error(t?.response?.data?.message??`加载失败`)}finally{y.value=!1}}function O(){S.current=1,D()}function k(e){S.current=e,D()}async function A(){b.value=!0;try{let t=(await m.get(`/wechat-users/export`,{params:{keyword:C.value.trim()||void 0,has_activity_reservation:w.value===``?void 0:w.value===`1`,has_ticket_grab_reservation:T.value===``?void 0:T.value===`1`},responseType:`blob`,timeout:12e4})).data,n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`微信用户列表-${new Date().toISOString().slice(0,10)}.xlsx`,r.click(),URL.revokeObjectURL(n),e.success(`已导出`)}catch(t){e.error(t?.response?.data?.message??`导出失败`)}finally{b.value=!1}}return n(()=>void D()),(e,n)=>{let s=r(`a-input`),l=r(`a-option`),p=r(`a-select`),m=r(`a-button`),D=r(`a-space`),j=r(`a-table-column`),M=r(`a-avatar`),N=r(`a-table`),P=r(`a-card`);return t(),o(P,{title:`用户管理 / 用户列表`},{default:i(()=>[f(D,{wrap:``,style:{"margin-bottom":`12px`}},{default:i(()=>[f(s,{modelValue:C.value,"onUpdate:modelValue":n[0]||=e=>C.value=e,placeholder:`搜索手机号或昵称`,style:{width:`240px`},"allow-clear":``,onPressEnter:O},null,8,[`modelValue`]),f(p,{modelValue:w.value,"onUpdate:modelValue":n[1]||=e=>w.value=e,"allow-clear":``,placeholder:`是否预约活动`,style:{width:`150px`}},{default:i(()=>[f(l,{value:`1`},{default:i(()=>[...n[3]||=[a(``,-1)]]),_:1}),f(l,{value:`0`},{default:i(()=>[...n[4]||=[a(``,-1)]]),_:1})]),_:1},8,[`modelValue`]),f(p,{modelValue:T.value,"onUpdate:modelValue":n[2]||=e=>T.value=e,"allow-clear":``,placeholder:`是否预约抢票`,style:{width:`150px`}},{default:i(()=>[f(l,{value:`1`},{default:i(()=>[...n[5]||=[a(``,-1)]]),_:1}),f(l,{value:`0`},{default:i(()=>[...n[6]||=[a(``,-1)]]),_:1})]),_:1},8,[`modelValue`]),f(m,{type:`primary`,onClick:O},{default:i(()=>[...n[7]||=[a(`查询`,-1)]]),_:1}),f(m,{loading:b.value,onClick:A},{default:i(()=>[...n[8]||=[a(`导出`,-1)]]),_:1},8,[`loading`])]),_:1}),f(N,{class:`list-data-table`,data:x.value,loading:y.value,"row-key":`id`,pagination:{current:S.current,pageSize:S.pageSize,total:S.total,showTotal:!0},onPageChange:k},{columns:i(()=>[f(j,{title:``,width:72},{cell:i(({rowIndex:e})=>[a(c(d(h)(e,S.current,S.pageSize)),1)]),_:1}),f(j,{title:`头像`,width:72},{cell:i(({record:e})=>[f(M,{size:40},{default:i(()=>[e.avatar_url?(t(),u(`img`,{key:0,src:e.avatar_url,alt:``},null,8,_)):(t(),u(`span`,v,`访`))]),_:2},1024)]),_:1}),f(j,{title:`手机号`,"data-index":`phone`,width:140}),f(j,{title:`昵称`,"data-index":`nickname`,width:120,ellipsis:``,tooltip:``}),f(j,{title:`姓名`,"data-index":`real_name`,width:100,ellipsis:``,tooltip:``}),f(j,{title:`访问量`,"data-index":`visit_count`,width:90,align:`right`}),f(j,{title:`预约活动`,"min-width":180,ellipsis:``,tooltip:``},{cell:i(({record:e})=>[a(c(E(e.activity_reservations)),1)]),_:1}),f(j,{title:`预约抢票`,"min-width":180,ellipsis:``,tooltip:``},{cell:i(({record:e})=>[a(c(E(e.ticket_grab_reservations)),1)]),_:1}),f(j,{title:`注册时间`,width:180},{cell:i(({record:e})=>[a(c(d(g)(e.created_at)),1)]),_:1})]),_:1},8,[`data`,`loading`,`pagination`])]),_:1})}}});export{y as default};