import{P as V}from"./index-97-mhYEo.js";import{b7 as W,u as G,as as U,t as Y,O as H,r as J,bP as Q,bM as X,aS as Z,aT as c,bf as ee,a$ as s,aY as d,b0 as t,ba as n,bQ as se,bg as w,bN as A,bh as N,b9 as h,bd as R,N as j,a_ as v,bR as P,J as l,v as ae,bS as re,s as m,bT as te,aX as oe}from"./index-xnhGKCfe.js";import{j as ne}from"./common-CGnrk9PK.js";import{c as b}from"./currency-DTUBf2lI.js";import{u as ce}from"./index-CExwpARe.js";import{u as ie}from"./useNotifications-D5cP5bJF.js";import"./pre-D84pmYLY.js";import"./useProtocol-DJp7lFWi.js";import"./index-BPVaJMve.js";import"./use-route-ooe9RtXE.js";import"./use-placeholder-CaxDMxdA.js";import"./use-height-D2WRcW7G.js";import"./index-C0hGNjES.js";const de={class:"message-detail"},le={class:"message-content"},ue={class:"head"},pe={class:"title"},he={class:"subTitle"},_e={class:"terms"},ge={class:"parting"},ve={class:"wa"},me={class:"t1"},fe={class:"t2"},ye={key:0,class:"requirements-box"},we={class:"requirements-title"},be={key:0,class:"requirement-item"},xe={class:"requirement-label"},Ce={class:"progress-bar-wrap"},ke={class:"progress-bar"},Te={class:"progress-value"},Ie={key:1,class:"requirement-item"},Ae={class:"requirement-label"},Ne={class:"progress-bar-wrap"},Re={class:"progress-bar"},je={class:"progress-value"},Pe={key:1,class:"rewardsContent"},De={class:"mark"},Oe={class:"rewardsText"},Ee={class:"mark"},qe={class:"rewardsText"},Fe=["onClick"],Se={key:1,class:"terms"},Le={class:"message-actions"},Me={key:0,class:"btns"},$e=W({__name:"index",setup(Be){const{t:a}=G(),x=U(),f=Y(),_=Number(x.query.id),i=J({}),{isDelete:D,hasReward:O}=ie(),{serviceList:C,getServiceList:E,goServicePage:q}=ce();H(async()=>{var e;await k(),((e=i.value)==null?void 0:e.jumpType)===4&&await E(!0)});const F=e=>{switch(e){case 1:return a("t626");case 2:return a("t239");case 3:return a("t644");default:return""}},S=e=>e.state!==1?!1:e.rewardType===1||e.rewardType===2&&e.rechargeAmount>0&&e.finishedRechargeCount>0&&e.finishedRechargeAmount>=e.rechargeAmount&&e.finishedRechargeCount>=e.rechargeCount,k=async()=>{if(_){const{data:e,code:o}=await Q({id:_});o==0&&(i.value=e)}},L=()=>{_&&P({title:a("t632"),isCancel:!0,cancelText:a("t83"),confirmText:a("t86"),message:l("div",{style:"margin:50px 0;padding:0 10px"},a("t750")),confirm:async()=>{const{code:e,msg:o}=await re({inmailId:Number(x.query.id)});e===0?(m(a("t169")),f.go(-1),D.value=!0):m(o)}})},M=async e=>{try{const{code:o,msg:u}=await te({orderNo:e});o===0&&(await k(),m(a("t637")),O.value[_]=!1)}catch(o){m(o||a("t638"))}},$=e=>l("div",{class:"rewardsDialog"},[l("style",{},`
    .getIcon {
      display: flex;
      gap: 12px 6px;
      font-size:24px;
      justify-content: center;
      margin-top: 20px;
      flex-wrap: wrap;
    }
    p{
      color: var(--text_primary, #D4E8FF);
    }
    .getIcon .getImg {
      display: flex;
      align-items: center;
      gap:0 6px;
      border-radius: 30px;
      background: var(--secondary_color3);
      padding:4px 8px;
    }
    .getIcon .getImg .e{
      width:20px;
      height:20px;
    }
    .getIcon .getImg span {
      color: var(--text_primary, #D4E8FF);
      font-size:12px;
    }
  `),l("p",a("t635")),l("div",{class:"getIcon"},[e.rewardAmount>0?l("div",{class:"getImg"},[l(v,{name:"moneyIcon",iconClass:"e"}),l("span",b(e.rewardAmount))]):null,e.rewardCoupons.length>0?e.rewardCoupons.map((o,u)=>l("div",{class:"getImg",key:u},[l(v,{name:"bonusIcon",iconClass:"e"}),l("span",o.name)])):null])]),B=e=>{P({title:`${e.rewardType==1?a("t623"):a("t624")} ${a("t625")}`,message:$(e),confirmText:a("t582"),confirm:async()=>{await M(e.orderNo)}})},z=e=>{var u;const o=Object.freeze({NONE:1,LINK:2,PAGE:3,WORK:4});if(e.jumpType===o.NONE)return"";if(e.jumpType===o.LINK)ne(e.jumpLink);else if(e.jumpType===o.PAGE){const p=(u=ae[e==null?void 0:e.jumpPage])==null?void 0:u.name;p&&f.push({name:p})}else if(e.jumpType===o.WORK&&Array.isArray(C.value)){const p=C.value.find(g=>g.workOrderTypeId===(e==null?void 0:e.jumpPage));return p?q(p):f.push({name:"workOrder"})}else return""};return(e,o)=>{const u=X("safe-html");return c(),Z(V,{isOverfllow:!1},{default:ee(()=>{var p,g,T,I;return[s("div",de,[s("div",le,[s("div",ue,[s("div",pe,t(i.value.title),1),s("div",he,t(n(se)(i.value.createTime)),1)]),((p=i.value.rewards)==null?void 0:p.length)!==0?(c(),d(w,{key:0},[s("div",_e,[A(s("p",null,null,512),[[u,i.value.content]])]),s("div",ge,t(n(a)("t625")),1),(c(!0),d(w,null,N(i.value.rewards,r=>(c(),d("div",{class:"rewards",key:r.orderNo},[s("div",ve,[s("div",me,t(r.rewardType==1?n(a)("t623"):n(a)("t624"))+" "+t(n(a)("t625")),1),s("div",fe,t(F(r.state)),1)]),r.rewardType==2?(c(),d("div",ye,[s("div",we,t(n(a)("t628")),1),r.rechargeAmount>0?(c(),d("div",be,[s("div",xe,t(n(a)("t56"))+" "+t(n(b)(r.rechargeAmount)),1),s("div",Ce,[s("div",ke,[s("div",{class:"progress-bar-inner",style:R({width:(r.rechargeAmount?Math.min(r.finishedRechargeAmount/r.rechargeAmount,1)*100:0).toFixed(2)+"%"})},null,4)]),s("div",Te,t(r.finishedRechargeAmount)+"/"+t(r.rechargeAmount),1)])])):h("",!0),r.rechargeCount>0?(c(),d("div",Ie,[s("div",Ae,t(n(a)("t56"))+" "+t(r.rechargeCount)+" "+t(n(a)("t288")),1),s("div",Ne,[s("div",Re,[s("div",{class:"progress-bar-inner",style:R({width:(r.rechargeCount?Math.min(r.finishedRechargeCount/r.rechargeCount,1)*100:0).toFixed(2)+"%"})},null,4)]),s("div",je,t(r.finishedRechargeCount)+"/"+t(r.rechargeCount),1)])])):h("",!0)])):h("",!0),Number(r.rewardAmount)>0?(c(),d("div",Pe,[s("div",De,[j(v,{name:"moneyIcon","icon-class":"d"})]),s("div",Oe,[s("div",null,t(n(a)("t788")),1),s("div",null,t(n(b)(r.rewardAmount)),1)])])):h("",!0),Array.isArray(r.rewardCoupons)&&r.rewardCoupons.length?(c(!0),d(w,{key:2},N(r.rewardCoupons,(y,K)=>(c(),d("div",{class:"rewardsContent",key:K},[s("div",Ee,[j(v,{name:"bonusIcon","icon-class":"d"})]),s("div",qe,[s("div",null,t(y.name),1),s("div",null,t(y.description),1)])]))),128)):h("",!0),S(r)?(c(),d("div",{key:3,class:"claim",onClick:y=>B(r)},t(n(a)("t631")),9,Fe)):h("",!0)]))),128))],64)):(c(),d("div",Se,[A(s("p",null,null,512),[[u,i.value.content]])]))]),s("div",Le,[i.value&&((g=i.value)!=null&&g.inmailId)?(c(),d("div",Me,[s("div",{class:"delRead",onClick:L},t(n(a)("t632")),1),((T=i.value)==null?void 0:T.jumpType)!==1?(c(),d("div",{key:0,class:"readAll btn_main_style",onClick:o[0]||(o[0]=r=>z(i.value))},t(((I=i.value)==null?void 0:I.jumpButtonText)||n(a)("t633")),1)):h("",!0)])):h("",!0)])])]}),_:1})}}}),ss=oe($e,[["__scopeId","data-v-7857a18d"]]);export{ss as default};
