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
6.2 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{A as e,C as t,D as n,Dt as r,J as i,O as a,Q as o,S as s,T as c,X as l,_ as u,an as d,ct as f,d as p,en as m,f as h,gt as g,h as _,k as v,lt as y,m as b,ot as x,vt as S,w as C,x as w}from"./vue.runtime.esm-bundler-Dt_AyShc.js";import{g as T}from"./index-BpfnlerO.js";import{t as E}from"./_plugin-vue_export-helper-CXTkFu_Z.js";import{n as D}from"./datetimeShanghai-C-yEb-Ts.js";import{p as O,u as k}from"./audience-WprsEOZs.js";var A={class:`approve-hint`},j=E(e({__name:`AudienceApproveDialog`,props:{open:{type:Boolean},count:{},submitting:{type:Boolean},defaultTime:{},defaultAddress:{}},emits:[`close`,`confirm`],setup(e,{emit:n}){let r=e,c=n,l=g({event_time_text:``,event_address_text:``});x(()=>[r.open,r.defaultTime,r.defaultAddress],([e])=>{e&&(l.event_time_text=(r.defaultTime??``).trim(),l.event_address_text=(r.defaultAddress??``).trim())},{immediate:!0});function u(){let e=l.event_time_text.trim(),t=l.event_address_text.trim();!e||!t||c(`confirm`,{event_time_text:e,event_address_text:t})}return(n,r)=>{let p=o(`el-input`),m=o(`el-form-item`),h=o(`el-form`),g=o(`el-button`),_=o(`el-dialog`);return i(),t(_,{"model-value":e.open,title:`审核通过并发送短信`,width:`480px`,"destroy-on-close":``,"close-on-click-modal":!e.submitting,onClose:r[3]||=e=>c(`close`)},{footer:f(()=>[v(g,{disabled:e.submitting,onClick:r[2]||=e=>c(`close`)},{default:f(()=>[...r[6]||=[a(`取消`,-1)]]),_:1},8,[`disabled`]),v(g,{type:`primary`,loading:e.submitting,disabled:!l.event_time_text.trim()||!l.event_address_text.trim(),onClick:u},{default:f(()=>[...r[7]||=[a(` 确认发送短信 `,-1)]]),_:1},8,[`loading`,`disabled`])]),default:f(()=>[s(`p`,A,[r[4]||=a(` 将向 `,-1),s(`strong`,null,d(e.count),1),r[5]||=a(` 位待审核观众发送审核通过短信。请填写正式路演时间和地点。 `,-1)]),v(h,{"label-position":`top`},{default:f(()=>[v(m,{label:`路演时间`,required:``},{default:f(()=>[v(p,{modelValue:l.event_time_text,"onUpdate:modelValue":r[0]||=e=>l.event_time_text=e,maxlength:`128`,placeholder:`例如:9月20日`},null,8,[`modelValue`])]),_:1}),v(m,{label:`路演地点`,required:``},{default:f(()=>[v(p,{modelValue:l.event_address_text,"onUpdate:modelValue":r[1]||=e=>l.event_address_text=e,maxlength:`255`,placeholder:`例如:上海……`},null,8,[`modelValue`])]),_:1})]),_:1})]),_:1},8,[`model-value`,`close-on-click-modal`])}}}),[[`__scopeId`,`data-v-a7cc3a34`]]),M={class:`audience-sms-panel`},N={class:`audience-sms-head`},P={class:`audience-sms-filters`},F=[`disabled`],I={class:`table-responsive`},L={class:`audience-sms-table`},R={key:0},z={class:`audience-sms-mobile`},B=[`title`],V=[`disabled`,`onClick`],H={colspan:`4`},U={class:`audience-sms-footer`},W={class:`audience-table-pager`},G=[`disabled`],K=[`disabled`],q=E(e({__name:`AudienceSmsLogsPane`,props:{competitionId:{}},setup(e,{expose:t}){let o=e,f=S(!1),g=S(null),v=S([]),E=S(1),A=S(15),j=S(0),q=w(()=>Math.max(1,Math.ceil(j.value/A.value))),J=S(``),Y=S(``);function X(e){return e.status===`dropped`||e.status===`failed`}function Z(e){return e.status===`delivered`}async function Q(e=E.value){f.value=!0;try{let t=await k(o.competitionId,{page:e,per_page:A.value,mobile:J.value.trim()||void 0,status:Y.value||void 0});v.value=t.data,E.value=t.meta.current_page,A.value=t.meta.per_page,j.value=t.meta.total}catch(e){T.error(e instanceof Error?e.message:`加载短信发送列表失败`)}finally{f.value=!1}}async function $(e){if(!(!e.can_resend||g.value)){g.value=e.id;try{await O(o.competitionId,e.id),T.success(`已重新发送`),await Q(1)}catch(e){T.error(e instanceof Error?e.message:`重发短信失败`)}finally{g.value=null}}}return x(()=>o.competitionId,()=>{E.value=1,Q(1)},{immediate:!0}),t({reload:()=>Q(1)}),(e,t)=>(i(),c(`section`,M,[s(`div`,N,[t[7]||=s(`div`,null,[s(`h6`,null,`短信发送列表`),s(`p`,null,`登录验证码、预报名与审核通过短信的发送记录,失败可重发`)],-1),s(`div`,P,[y(s(`input`,{"onUpdate:modelValue":t[0]||=e=>J.value=e,class:`form-control form-control-sm`,type:`search`,placeholder:`手机号码`,onKeydown:t[1]||=b(_(e=>Q(1),[`prevent`]),[`enter`])},null,544),[[h,J.value]]),y(s(`select`,{"onUpdate:modelValue":t[2]||=e=>Y.value=e,class:`form-select form-select-sm`},[...t[6]||=[n(`<option value="" data-v-e6563b58>全部状态</option><option value="delivered" data-v-e6563b58>发送成功</option><option value="failed" data-v-e6563b58>发送失败</option><option value="pending" data-v-e6563b58>待回执</option><option value="sending" data-v-e6563b58>发送中</option>`,5)]],512),[[p,Y.value]]),s(`button`,{class:`btn btn-primary btn-sm`,type:`button`,disabled:f.value,onClick:t[3]||=e=>Q(1)},`查询`,8,F)])]),s(`div`,I,[s(`table`,L,[t[10]||=s(`thead`,null,[s(`tr`,null,[s(`th`,null,`手机号码`),s(`th`,null,`发送时间`),s(`th`,null,`送达时间`),s(`th`,null,`发送状态`)])],-1),s(`tbody`,null,[v.value.length?C(``,!0):(i(),c(`tr`,R,[...t[8]||=[s(`td`,{colspan:`4`,class:`audience-sms-empty`},`暂无短信发送记录`,-1)]])),(i(!0),c(u,null,l(v.value,(e,n)=>(i(),c(u,{key:e.id},[s(`tr`,{class:m([`audience-sms-meta`,{"is-alt":n%2==1}])},[s(`td`,null,[s(`span`,z,[t[9]||=s(`i`,{"aria-hidden":`true`},`i`,-1),a(d(e.mobile),1)])]),s(`td`,null,d(r(D)(e.sent_at)),1),s(`td`,null,d(r(D)(e.delivered_at)),1),s(`td`,null,[s(`span`,{class:m([`audience-sms-status`,{"is-ok":Z(e),"is-fail":X(e)}])},[a(d(e.status_label)+` `,1),X(e)&&e.dropped_reason?(i(),c(`abbr`,{key:0,class:`audience-sms-reason`,title:e.dropped_reason},` ? `,8,B)):C(``,!0)],2),e.can_resend?(i(),c(`button`,{key:0,class:`audience-sms-resend`,type:`button`,disabled:g.value===e.id,onClick:t=>$(e)},d(g.value===e.id?`重发中…`:`重发`),9,V)):C(``,!0)])],2),s(`tr`,{class:m([`audience-sms-body`,{"is-alt":n%2==1}])},[s(`td`,H,d(e.content||`—`),1)],2)],64))),128))])])]),s(`div`,U,[s(`span`,null,`显示 `+d(v.value.length)+` / `+d(j.value)+` 条 · 第 `+d(E.value)+` / `+d(q.value)+` 页`,1),s(`nav`,W,[s(`button`,{class:`btn btn-sm btn-light border`,type:`button`,disabled:E.value<=1,onClick:t[4]||=e=>Q(E.value-1)},` 上一页 `,8,G),s(`button`,{class:`btn btn-sm btn-light border`,type:`button`,disabled:E.value>=q.value,onClick:t[5]||=e=>Q(E.value+1)},` 下一页 `,8,K)])])]))}}),[[`__scopeId`,`data-v-e6563b58`]]);export{j as n,q as t};