import{o as n,g as i,b as d,w as o,u as s,F as _,f as u,a as t,t as l,D as m,i as f,h,c as y}from"./app-BYcXwl4U.js";import{i as k,c as P}from"./app-a6cKceqE.js";import{T as v}from"./app-CrjU8lgK.js";import{_ as x}from"./app-CQ-vNlMj.js";import{T}from"./app-BbPGXKj1.js";import{T as g,_ as w,a as I}from"./app-CxLTQg0E.js";import{D as C}from"./app-7GBSHA5C.js";function $(){k(this),this.selectedPeriodId=0,this.amount=-1,this.$delay(function(){if(this.userInstance.periodId>0){let c=this;this.allPeriods.$find(function(e,r){return c.userInstance.periodId==r.id})!=null&&this.selectPeriod(this.userInstance.periodId)}}),this.selectPeriod=function(c){this.selectedPeriodId=c,this.amount=this.prices.$find(function(e,r){return r.periodId==c}).price},this.goNext=function(){this.userInstance.id>0&&this.selectedPeriodId>0&&(window.location="/anti-ddos/instances/renewConfirm?userInstanceId="+this.userInstance.id+"&periodId="+this.selectedPeriodId)}}const N=t("a",{href:"/anti-ddos/instances"},"选择要续费的实例",-1),b=["value"],B=["value"],S=t("td",null,"高防产品",-1),V={key:0},D={key:1,class:"red"},E=t("td",null,"高防IP",-1),F={key:0},A={key:1,class:"red"},L=t("td",null,"当前有效期",-1),M={key:0,class:"comment"},R={class:"red"},j={key:1,class:"comment"},q=t("td",null,"新续有效期 *",-1),z={key:0,class:"label-group"},G=["onClick"],H={key:1,class:"red"},J=t("td",null,"价格",-1),K={key:0,class:"disabled"},O={key:1},se={__name:"renew",setup(c){const e=P(new $);return(r,p)=>(n(),i(_,null,[d(g,{step:"pay"},{default:o(()=>[d(w,null,{default:o(()=>[d(I,null,{default:o(()=>[N]),_:1}),d(I,{code:"pay"},{default:o(()=>[u(" 支付 ")]),_:1})]),_:1})]),_:1}),d(x,{action:"$",onSuccess:s(e).success,class:"mt-2"},{default:o(()=>[t("input",{type:"hidden",name:"userInstanceId",value:s(e).userInstance.id},null,8,b),t("input",{type:"hidden",name:"periodId",value:s(e).selectedPeriodId},null,8,B),d(C,null,{default:o(()=>[t("tbody",null,[t("tr",null,[S,t("td",null,[s(e).userInstance.package.id>0?(n(),i("div",V,l(s(e).userInstance.package.summary),1)):(n(),i("span",D,"已删除"))])]),t("tr",null,[E,t("td",null,[s(e).userInstance.instance.id>0?(n(),i("div",F,[(n(!0),i(_,null,m(s(e).userInstance.instance.ipAddresses,a=>(n(),i("div",null,l(a),1))),256))])):(n(),i("span",A,"已删除"))])]),t("tr",null,[L,t("td",null,[u(l(s(e).userInstance.dayTo)+" ",1),s(e).userInstance.isExpired?(n(),i("p",M,[t("span",R,"已过期，续费后新的有效期将会从今天（"+l(s(e).userInstance.today)+"）开始。",1)])):(n(),i("p",j,"续费后，将会在此基础上增加新的有效期。"))])]),t("tr",null,[q,t("td",null,[s(e).allPeriods.length>0?(n(),i("div",z,[(n(!0),i(_,null,m(s(e).allPeriods,a=>(n(),i("a",{onClick:f(Q=>s(e).selectPeriod(a.id),["prevent"])},[d(T,{secondary:a.id!=s(e).selectedPeriodId},{default:o(()=>[u(l(a.count)+l(a.unitName),1)]),_:2},1032,["secondary"])],8,G))),256))])):(n(),i("span",H,"没有可用的有效期"))])]),t("tr",null,[J,t("td",null,[s(e).amount==0?(n(),i("span",K,"没有找到对应价格")):h("",!0),s(e).amount>0?(n(),i("span",O,l(s(e).amount)+"元",1)):h("",!0)])])])]),_:1}),s(e).amount>0?(n(),y(v,{key:0,type:"button",onClick:p[0]||(p[0]=f(a=>s(e).goNext(),["prevent"]))},{default:o(()=>[u("下一步")]),_:1})):h("",!0)]),_:1},8,["onSuccess"])],64))}};export{se as default};
