import{r as m,o as l,g as r,b as a,u as t,w as n,F as T,a as i,f as o,h as v,d as p,e as _,D as k,c as $,t as w}from"./app-DA7OTM4Q.js";import{i as x,c as I}from"./app-BT68AfZ-.js";import{_ as C}from"./app-mzOq0BJu.js";import{_ as P}from"./app-DokSVapq.js";import{_ as f}from"./app-CdmRPZIU.js";import{_ as V}from"./app-DuUYZNNT.js";import{_ as h,a as d}from"./app-BHFzVhjx.js";import{_ as B}from"./app-CKSEN_Rg.js";import{D as A}from"./app-DNL2FXPk.js";import"./app-scFtFqL8.js";import"./app-DREBJ-ou.js";import"./app-CWBL8eTX.js";import"./app-CnGe5nlE.js";import"./app-OC5wWJiS.js";import"./app-BX4pd6U-.js";import"./app-Bhreb6Cm.js";import"./app-SLkqftrw.js";import"./app-DSiZNBrr.js";import"./app-C5ROEzFd.js";import"./app-Bnbo6OlJ.js";import"./app-Dxa5h-uG.js";import"./app-AbPAjGV5.js";import"./app-BqY8p2gl.js";import"./app-C-GI59rl.js";import"./app-BotiHebp.js";import"./app-Zes_jb7S.js";function F(){x(this),this.formattedAmount="",this.hasRegionPrice=!1,this.$delay(function(){this.changePriceType(this.config.priceType),this.$watch(()=>this.config.priceType,function(u){this.formattedAmount="",this.changePriceType(u)})}),this.success=function(u){this.formattedAmount=u.data.amountFormatted,this.hasRegionPrice=u.data.hasRegionPrice},this.changePriceType=function(u){switch(u){case"traffic":this.$refs.trafficInput.focus();break;case"bandwidth":this.$refs.bandwidthInput.focus();break}},this.requestId="",this.change=function(){this.formattedAmount="",this.hasRegionPrice=!1,this.$refs.calculatorForm.submit()}}const R=i("td",{class:"title"},"计费类型",-1),U={key:0},D={key:1},N={key:2},S=i("td",null,"所需带宽",-1),z={class:"ui fields inline"},E={class:"ui field"},G={class:"ui field"},q=i("td",null,"所需流量",-1),L={class:"ui fields inline"},M={class:"ui field"},j={class:"ui field"},H=i("td",null,"所在区域",-1),J=i("td",null,"价格",-1),K={key:0},O={key:0,class:"small grey",style:{"font-weight":"normal"}},Q={key:1,class:"disabled"},Ve={__name:"calculator",setup(u){const g=m(),y=m(),b=m(),e=I(new F,{refs:{calculatorForm:b,trafficInput:g,bandwidthInput:y}});return(W,c)=>(l(),r(T,null,[a(C,{ctx:t(e),"active-tab":"calculator"},null,8,["ctx"]),a(P,{action:"$",onSuccess:t(e).success,ref_key:"calculatorForm",ref:b},{default:n(()=>[a(A,null,{default:n(()=>[i("tbody",null,[i("tr",null,[R,i("td",null,[t(e).config.canChangePriceType?(l(),r("div",U,[a(f,{name:"priceType",value:"bandwidth",modelValue:t(e).config.priceType,"onUpdate:modelValue":c[0]||(c[0]=s=>t(e).config.priceType=s)},{default:n(()=>[o("按带宽计费")]),_:1},8,["modelValue"]),o("     "),a(f,{name:"priceType",value:"traffic",modelValue:t(e).config.priceType,"onUpdate:modelValue":c[1]||(c[1]=s=>t(e).config.priceType=s)},{default:n(()=>[o("按流量计费")]),_:1},8,["modelValue"]),o("     ")])):t(e).config.priceType=="bandwidth"?(l(),r("div",D,[a(f,{name:"priceType",value:"bandwidth",modelValue:t(e).config.priceType,"onUpdate:modelValue":c[2]||(c[2]=s=>t(e).config.priceType=s)},{default:n(()=>[o("按带宽计费")]),_:1},8,["modelValue"])])):t(e).config.priceType=="traffic"?(l(),r("div",N,[a(f,{name:"priceType",value:"traffic",modelValue:t(e).config.priceType,"onUpdate:modelValue":c[3]||(c[3]=s=>t(e).config.priceType=s)},{default:n(()=>[o("按流量计费")]),_:1},8,["modelValue"])])):v("",!0)])]),p(i("tr",null,[S,i("td",null,[i("div",z,[i("div",E,[a(V,{name:"bandwidth",size:"10",maxlength:"10",onInput:t(e).change,ref_key:"bandwidthInput",ref:y},null,8,["onInput"])]),i("div",G,[a(h,{name:"bandwidthUnit",onChange:t(e).change},{default:n(()=>[a(d,{value:"mb"},{default:n(()=>[o("Mbps")]),_:1}),a(d,{value:"gb"},{default:n(()=>[o("Gbps")]),_:1}),a(d,{value:"tb"},{default:n(()=>[o("Tbps")]),_:1})]),_:1},8,["onChange"])])])])],512),[[_,t(e).config.priceType=="bandwidth"]]),p(i("tr",null,[q,i("td",null,[i("div",L,[i("div",M,[a(V,{name:"traffic",size:"10",maxlength:"10",onInput:t(e).change,ref_key:"trafficInput",ref:g},null,8,["onInput"])]),i("div",j,[a(h,{name:"trafficUnit",onChange:t(e).change},{default:n(()=>[a(d,{value:"gb"},{default:n(()=>[o("GiB")]),_:1}),a(d,{value:"tb"},{default:n(()=>[o("TiB")]),_:1}),a(d,{value:"eb"},{default:n(()=>[o("EiB")]),_:1})]),_:1},8,["onChange"])])])])],512),[[_,t(e).config.priceType=="traffic"]]),p(i("tr",null,[H,i("td",null,[a(h,{name:"regionId",onChange:t(e).change},{default:n(()=>[a(d,{value:"0"},{default:n(()=>[o("[不区分区域]")]),_:1}),(l(!0),r(T,null,k(t(e).regions,s=>(l(),$(d,{value:s.id},{default:n(()=>[o(w(s.name),1)]),_:2},1032,["value"]))),256))]),_:1},8,["onChange"])])],512),[[_,t(e).regions.length>0]]),i("tr",null,[J,i("td",null,[t(e).formattedAmount.length>0?(l(),r("strong",K,[o(" ￥"+w(t(e).formattedAmount)+"元 ",1),t(e).hasRegionPrice?(l(),r("span",O,"（基于区域价格设定）")):v("",!0)])):(l(),r("span",Q,"-"))])])])]),_:1}),a(B,null,{default:n(()=>[o("计算价格")]),_:1})]),_:1},8,["onSuccess"])],64))}};export{Ve as default};
