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-SC54XQDl.js";import{i as x,c as I}from"./app-Ba7ZqSpq.js";import{_ as C}from"./app-DUMiz-D3.js";import{_ as P}from"./app-DFulsyXy.js";import{_ as f}from"./app-Y56vIEoR.js";import{_ as V}from"./app-CVQkwzlf.js";import{_ as h,a as d}from"./app-PrSv7rSt.js";import{_ as B}from"./app-DWUwCFNm.js";import{D as A}from"./app-ZeVDYyDS.js";import"./app-CL60OiIv.js";import"./app-D9TrJBlL.js";import"./app-_Ovp2dOH.js";import"./app-BjSCO7rC.js";import"./app-Dhl-Bw0H.js";import"./app-B2C_dtYI.js";import"./app-COidJXl1.js";import"./app-D_RBJHM6.js";import"./app-DnXuoh8P.js";import"./app-BZGObKCm.js";import"./app-BPIIxVwk.js";import"./app-PPG0ZS4d.js";import"./app-DgoEZtNT.js";import"./app-Ch8j4za4.js";import"./app-Dw0jKdCD.js";import"./app-CCkWSX4Q.js";import"./app-CNHjdV6U.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};
