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-BYcXwl4U.js";import{i as x,c as I}from"./app-a6cKceqE.js";import{_ as C}from"./app-DVF_9535.js";import{_ as P}from"./app-CQ-vNlMj.js";import{_ as f}from"./app-Dm54XnL8.js";import{_ as V}from"./app-Ufpj4Ll4.js";import{_ as h,a as d}from"./app-DxbU-QrX.js";import{_ as B}from"./app-CignoBaV.js";import{D as A}from"./app-7GBSHA5C.js";import"./app-DCd54JMo.js";import"./app-MrAtUXr3.js";import"./app-BWSI2Z1R.js";import"./app-DPDEogA0.js";import"./app-DxjODhok.js";import"./app-CabATHnR.js";import"./app-BhzV4gWo.js";import"./app-Btbk6LWy.js";import"./app-ysQ8KbGS.js";import"./app-Cp3gmk2J.js";import"./app--MWyBMkA.js";import"./app-BG60hdvp.js";import"./app-CNARLpXE.js";import"./app-SxAW7vhf.js";import"./app-D5k1HLu9.js";import"./app-BDgR0DSb.js";import"./app-CrjU8lgK.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};
