1.4.5.2
This commit is contained in:
9
EdgeAdmin/web/views/@default/finance/fee/@menu.html
Normal file
9
EdgeAdmin/web/views/@default/finance/fee/@menu.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<first-menu>
|
||||
<menu-item code="basic" href=".">基础设置</menu-item>
|
||||
<menu-item code="bandwidth" href=".bandwidth">按区域带宽计费</menu-item>
|
||||
<menu-item code="traffic" href=".traffic">按区域流量计费</menu-item>
|
||||
<span class="item disabled">|</span>
|
||||
<menu-item code="calculator" href=".calculator">价格计算器</menu-item>
|
||||
<span class="item disabled">|</span>
|
||||
<a href="/clusters/regions" class="item" target="_blank">区域设置 <i class="icon external small"></i></a>
|
||||
</first-menu>
|
||||
20
EdgeAdmin/web/views/@default/finance/fee/bandwidth.css
Normal file
20
EdgeAdmin/web/views/@default/finance/fee/bandwidth.css
Normal file
@@ -0,0 +1,20 @@
|
||||
th span {
|
||||
font-size: 0.9em;
|
||||
font-weight: normal;
|
||||
color: grey;
|
||||
}
|
||||
th a {
|
||||
font-weight: normal;
|
||||
visibility: hidden;
|
||||
}
|
||||
th:hover a {
|
||||
visibility: visible;
|
||||
}
|
||||
td a {
|
||||
visibility: hidden;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
td:hover a {
|
||||
visibility: visible;
|
||||
}
|
||||
/*# sourceMappingURL=bandwidth.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["bandwidth.less"],"names":[],"mappings":"AAAA,EACC;EACC,gBAAA;EACA,mBAAA;EACA,WAAA;;AAJF,EAOC;EACC,mBAAA;EACA,kBAAA;;AAIF,EAAE,MACD;EACC,mBAAA;;AAIF,EACC;EACC,kBAAA;EACA,gBAAA;;AAIF,EAAE,MACD;EACC,mBAAA","file":"bandwidth.css"}
|
||||
40
EdgeAdmin/web/views/@default/finance/fee/bandwidth.html
Normal file
40
EdgeAdmin/web/views/@default/finance/fee/bandwidth.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
|
||||
<div class="ui message warning" v-if="config.bandwidthPrice != null && !config.bandwidthPrice.supportRegions">
|
||||
尚未开启按区域带宽计费。 <a href="/finance/fee">[修改]</a>
|
||||
</div>
|
||||
|
||||
<p class="comment" v-if="regions.length == 0">暂时还没有区域。</p>
|
||||
|
||||
<table class="ui table selectable small definition celled">
|
||||
<thead class="full-width">
|
||||
<tr>
|
||||
<th class="three wide">区域\带宽区间</th>
|
||||
<th v-for="item in items" class="center">
|
||||
{{item.name}}
|
||||
<br/>
|
||||
<span>{{item.minSize}}-{{item.maxSize}}</span>
|
||||
<br/>
|
||||
<a href="" title="修改" @click.prevent="updateItem(item.id)"><i class="icon pencil small"></i></a>
|
||||
<a href="" title="删除" @click.prevent="deleteItem(item.id)"><i class="icon remove small"></i></a>
|
||||
</th>
|
||||
<th class="width10 center">
|
||||
<a href="" @click.prevent="createItem" style="visibility: visible">[+添加带宽区间]</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="region in regions">
|
||||
<td class="">{{region.name}}</td>
|
||||
<td v-for="item in items" class="center">
|
||||
<div>
|
||||
<span v-if="region.prices[item.id.toString()] != null">¥{{region.prices[item.id.toString()]}}元/Mbps </span>
|
||||
<span v-else> </span>
|
||||
</div>
|
||||
<div>
|
||||
<a href="" title="修改单位价格" @click.prevent="updatePrice(region.id, item.id)">[设置]</a>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
42
EdgeAdmin/web/views/@default/finance/fee/bandwidth.js
Normal file
42
EdgeAdmin/web/views/@default/finance/fee/bandwidth.js
Normal file
@@ -0,0 +1,42 @@
|
||||
Tea.context(function () {
|
||||
this.createItem = function () {
|
||||
teaweb.popup(Tea.url(".items.createBandwidthPopup"), {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.updateItem = function (itemId) {
|
||||
teaweb.popup(Tea.url(".items.updateBandwidthPopup", {itemId: itemId}), {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteItem = function (itemId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此带宽区间吗?", function () {
|
||||
that.$post(".items.delete")
|
||||
.params({
|
||||
itemId: itemId
|
||||
})
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
this.updatePrice = function (regionId, itemId) {
|
||||
teaweb.popup(Tea.url(".updatePricePopup", {regionId: regionId, itemId: itemId}), {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
31
EdgeAdmin/web/views/@default/finance/fee/bandwidth.less
Normal file
31
EdgeAdmin/web/views/@default/finance/fee/bandwidth.less
Normal file
@@ -0,0 +1,31 @@
|
||||
th {
|
||||
span {
|
||||
font-size: 0.9em;
|
||||
font-weight: normal;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: normal;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
th:hover {
|
||||
a {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
a {
|
||||
visibility: hidden;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
|
||||
td:hover {
|
||||
a {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
72
EdgeAdmin/web/views/@default/finance/fee/calculator.html
Normal file
72
EdgeAdmin/web/views/@default/finance/fee/calculator.html
Normal file
@@ -0,0 +1,72 @@
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
|
||||
<div class="margin"></div>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success" ref="calculatorForm">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">计费类型</td>
|
||||
<td>
|
||||
<radio name="priceType" :v-value="'bandwidth'" v-model="config.priceType">按带宽计费</radio>
|
||||
|
||||
<radio name="priceType" :v-value="'traffic'" v-model="config.priceType">按流量计费</radio>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="config.priceType == 'bandwidth'">
|
||||
<td>所需带宽</td>
|
||||
<td>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<input type="text" name="bandwidth" size="10" maxlength="10" @input="change" ref="bandwidthInput"/>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown auto-width" name="bandwidthUnit" @change="change">
|
||||
<option value="mb">Mbps</option>
|
||||
<option value="gb">Gbps</option>
|
||||
<option value="tb">Tbps</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="config.priceType == 'traffic'">
|
||||
<td>所需流量</td>
|
||||
<td>
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<input type="text" name="traffic" size="10" maxlength="10" @input="change" ref="trafficInput"/>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown auto-width" name="trafficUnit" @change="change">
|
||||
<option value="gb">GiB</option>
|
||||
<option value="tb">TiB</option>
|
||||
<option value="eb">EiB</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="regions.length > 0">
|
||||
<td>所在区域</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="regionId" @change="change">
|
||||
<option value="0">[不区分区域]</option>
|
||||
<option v-for="region in regions" :value="region.id">{{region.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>价格</td>
|
||||
<td>
|
||||
<strong v-if="formattedAmount.length > 0">
|
||||
¥{{formattedAmount}}元
|
||||
<span v-if="hasRegionPrice" class="small grey" style="font-weight: normal">(基于区域价格设定)</span>
|
||||
</strong>
|
||||
<span v-else class="disabled">-</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<submit-btn>计算价格</submit-btn>
|
||||
</form>
|
||||
46
EdgeAdmin/web/views/@default/finance/fee/calculator.js
Normal file
46
EdgeAdmin/web/views/@default/finance/fee/calculator.js
Normal file
@@ -0,0 +1,46 @@
|
||||
Tea.context(function () {
|
||||
this.formattedAmount = ""
|
||||
this.hasRegionPrice = false
|
||||
|
||||
this.$delay(function () {
|
||||
this.changePriceType(this.config.priceType)
|
||||
|
||||
this.$watch("config.priceType", function (priceType) {
|
||||
this.formattedAmount = ""
|
||||
this.changePriceType(priceType)
|
||||
})
|
||||
})
|
||||
|
||||
this.success = function (resp) {
|
||||
this.formattedAmount = resp.data.amountFormatted
|
||||
this.hasRegionPrice = resp.data.hasRegionPrice
|
||||
}
|
||||
|
||||
this.changePriceType = function (priceType) {
|
||||
switch (priceType) {
|
||||
case "traffic":
|
||||
this.$refs.trafficInput.focus()
|
||||
break
|
||||
case "bandwidth":
|
||||
this.$refs.bandwidthInput.focus()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.requestId = ""
|
||||
this.change = function () {
|
||||
this.formattedAmount = ""
|
||||
this.hasRegionPrice = false
|
||||
|
||||
let requestId = Math.random().toString()
|
||||
this.requestId = requestId
|
||||
|
||||
this.$post("$")
|
||||
.form(this.$refs.calculatorForm)
|
||||
.success(function (resp) {
|
||||
if (requestId == this.requestId) {
|
||||
this.success(resp)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
156
EdgeAdmin/web/views/@default/finance/fee/index.html
Normal file
156
EdgeAdmin/web/views/@default/finance/fee/index.html
Normal file
@@ -0,0 +1,156 @@
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
|
||||
<div class="margin"></div>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">启用计费</td>
|
||||
<td>
|
||||
<checkbox name="isOn" v-model="config.isOn"></checkbox>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody v-show="config.isOn">
|
||||
<tr v-show="!config.enablePlans">
|
||||
<td>默认结算周期</td>
|
||||
<td>
|
||||
<radio name="pricePeriod" :v-value="'daily'" v-model="config.pricePeriod">按日结算</radio>
|
||||
<radio name="pricePeriod" :v-value="'monthly'" v-model="config.pricePeriod">按月结算</radio>
|
||||
<div v-if="config.pricePeriod == 'daily'">
|
||||
<p class="comment">按自然日流量或带宽峰值结算,每天出前一天的账单。此选项不适用于套餐计费。<br/><strong style="margin-top: 0.3em;display: block">请谨慎修改此选项,如果当月已生成了按月结算账单,则结算周期变更需要在下个月才会生效。</strong></div>
|
||||
<p class="comment" v-if="config.pricePeriod == 'monthly'">按自然月流量或带宽峰值结算,每月一日出上月的账单。此选项不适用于套餐计费。<br/><strong style="margin-top: 0.3em;display: block">请谨慎修改此选项,如果当月已生成了按日结算账单,则结算周期需要在下个月才会生效。</strong></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">默认计费方式</td>
|
||||
<td>
|
||||
<radio name="priceType" :v-value="'bandwidth'" v-model="config.priceType">按带宽计费</radio>
|
||||
<radio name="priceType" :v-value="'traffic'" v-model="config.priceType">按流量计费</radio>
|
||||
<p class="comment">用户默认的计费方式,<strong>请谨慎修改此选项,如果当月已经生成了账单,则计费方式需要在下个月才会生效。</strong></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>按带宽计费设置</td>
|
||||
<td>
|
||||
<plan-price-bandwidth-config-box :v-plan-price-bandwidth-config="config.bandwidthPrice"></plan-price-bandwidth-config-box>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>按流量计费设置</td>
|
||||
<td>
|
||||
<plan-price-traffic-config-box :v-plan-price-traffic-config="config.trafficPrice"></plan-price-traffic-config-box>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="color-border">使用套餐计费</td>
|
||||
<td>
|
||||
<checkbox name="enablePlans" v-model="config.enablePlans"></checkbox>
|
||||
<p class="comment">选中后,表示使用套餐计费,而不使用流量和带宽计费;开启后可以在 <a href="/plans">[套餐管理]</a> 中添加套餐,服务可能在绑定套餐后才能使用;如果不开启,则表示自动使用流量和带宽阶梯价格计费。<br/><strong style="margin-top: 0.3em;display: block">请谨慎选择此选项,如果当月已经产生了按流量/带宽账单,再修改为使用套餐计费,可能会重复产生费用;同样,如果当月已经产生了套餐计费,再改为流量/带宽计费,也可能会重复产生费用。</strong></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="config.enablePlans">
|
||||
<td class="color-border">允许用户管理套餐</td>
|
||||
<td>
|
||||
<checkbox name="showPlansInUserSystem" v-model="config.showPlansInUserSystem"></checkbox>
|
||||
<p class="comment">选中后,在用户界面中显示套餐列表,用户可以购买和续费套餐;取消选中,表示用户界面中不显示套餐列表。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div v-show="config.isOn && !config.enablePlans">
|
||||
<h4 style="margin-top: 1.5em">流量包</h4>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">启用流量包</td>
|
||||
<td>
|
||||
<checkbox name="enableTrafficPackages" v-model="config.enableTrafficPackages"></checkbox>
|
||||
<p class="comment">启用后,在流量计费时优先从用户已购流量包中扣除。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="config.enableTrafficPackages">
|
||||
<td>在用户界面显示流量包</td>
|
||||
<td>
|
||||
<checkbox name="showTrafficPackages" v-model="config.showTrafficPackages"></checkbox>
|
||||
<p class="comment">在用户界面显示流量包相关内容,用户也可以购买流量包。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div v-show="config.isOn && !config.enablePlans">
|
||||
<h4 style="margin-top: 1.5em">用户自定义</h4>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">允许用户自选计费方式</td>
|
||||
<td>
|
||||
<checkbox name="userCanChangePriceType" v-model="config.userCanChangePriceType"></checkbox>
|
||||
<p class="comment">选中后,表示允许用户可以自选计费方式(按流量还是按带宽);取消选中后,所有用户都将使用默认的计费方式。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>允许用户自选计费周期</td>
|
||||
<td>
|
||||
<checkbox name="userCanChangePricePeriod" v-model="config.userCanChangePricePeriod"></checkbox>
|
||||
<p class="comment">选中后,表示允许用户可以自选计费周期(按月还是按日);取消选中后,所有用户都将使用默认的计费周期。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4 style="margin-top: 1.5em">用户界面</h4>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">显示价格和价格计算器</td>
|
||||
<td>
|
||||
<checkbox name="userUIShowPrices" v-model="config.userUI.showPrices"></checkbox>
|
||||
<p class="comment">选中后,表示在用户界面中显示价格和价格计算器。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div v-show="config.isOn">
|
||||
<h4 style="margin-top: 1.5em">逾期账单处理</h4>
|
||||
<table class="ui table selectable definition">
|
||||
<tr>
|
||||
<td class="title">开启逾期账单处理</td>
|
||||
<td>
|
||||
<checkbox name="unpaidBillPolicyIsOn" v-model="config.unpaidBillPolicy.isOn"></checkbox>
|
||||
<p class="comment">开启后,有逾期未支付账单,将会提醒用户。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="config.unpaidBillPolicy.isOn">
|
||||
<td>日账单逾期天数</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="unpaidBillPolicyMinDailyBillDays" maxlength="4" style="width: 5em" v-model="config.unpaidBillPolicy.minDailyBillDays"/>
|
||||
<span class="ui label">天</span>
|
||||
</div>
|
||||
<p class="comment">按日结算的账单超过一定天数没有支付,则认为逾期;如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="config.unpaidBillPolicy.isOn">
|
||||
<td>月账单逾期天数</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="unpaidBillPolicyMinMonthlyBillDays" maxlength="4" style="width: 5em" v-model="config.unpaidBillPolicy.minMonthlyBillDays"/>
|
||||
<span class="ui label">天</span>
|
||||
</div>
|
||||
<p class="comment">按月结算的账单超过一定天数没有支付,则认为逾期;如果为0表示没有限制。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="config.unpaidBillPolicy.isOn">
|
||||
<td>逾期后停止网站</td>
|
||||
<td>
|
||||
<checkbox name="unpaidBillPolicyDisableServers" v-model="config.unpaidBillPolicy.disableServers"></checkbox>
|
||||
<p class="comment">选中后,表示有逾期账单时停止用户的网站。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="margin"></div>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
3
EdgeAdmin/web/views/@default/finance/fee/index.js
Normal file
3
EdgeAdmin/web/views/@default/finance/fee/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyReloadSuccess("保存成功")
|
||||
})
|
||||
@@ -0,0 +1,36 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>添加带宽区间</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="100" ref="focus"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>最低带宽 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="minMB" maxlength="12" style="width:10em" v-model="minMB" autocomplete="off"/>
|
||||
<span class="ui label">Mbps</span>
|
||||
</div>
|
||||
<p class="comment">使用比特作为最小单位。<span v-if="minSize.length > 0">相当于:{{minSize}}。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>最高带宽 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="maxMB" maxlength="12" style="width:10em" v-model="maxMB" autocomplete="off"/>
|
||||
<span class="ui label">Mbps</span>
|
||||
</div>
|
||||
<p class="comment">使用比特作为最小单位,0表示没有限制。<span v-if="maxSize.length > 0">相当于:{{maxSize}}。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,29 @@
|
||||
Tea.context(function () {
|
||||
this.minMB = ""
|
||||
this.minSize = ""
|
||||
|
||||
this.maxMB = ""
|
||||
this.maxSize = ""
|
||||
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
this.$watch("minMB", function (v) {
|
||||
v = parseInt(v)
|
||||
if (isNaN(v) || v <= 0) {
|
||||
that.minSize = ""
|
||||
} else {
|
||||
that.minSize = teaweb.formatBits(v * Math.pow(1024, 2))
|
||||
}
|
||||
})
|
||||
this.$watch("maxMB", function (v) {
|
||||
v = parseInt(v)
|
||||
if (isNaN(v) || v < 0) {
|
||||
that.maxSize = ""
|
||||
} else if (v == 0) {
|
||||
that.maxSize = "∞"
|
||||
} else {
|
||||
that.maxSize = teaweb.formatBits(v * Math.pow(1024, 2))
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
h3 var {
|
||||
font-style: normal;
|
||||
}
|
||||
/*# sourceMappingURL=createPopup.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["createPopup.less"],"names":[],"mappings":"AAAA,EAAG;EACF,kBAAA","file":"createPopup.css"}
|
||||
@@ -0,0 +1,36 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>添加流量区间</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="100" ref="focus"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>最低流量 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="minGB" maxlength="12" style="width:10em" v-model="minGB" autocomplete="off"/>
|
||||
<span class="ui label">GiB</span>
|
||||
</div>
|
||||
<p class="comment">使用字节作为最小单位。<span v-if="minSize.length > 0">相当于:{{minSize}}。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>最高流量 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="maxGB" maxlength="12" style="width:10em" v-model="maxGB" autocomplete="off"/>
|
||||
<span class="ui label">GiB</span>
|
||||
</div>
|
||||
<p class="comment">使用字节作为最小单位,0表示没有限制。<span v-if="maxSize.length > 0">相当于:{{maxSize}}。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,29 @@
|
||||
Tea.context(function () {
|
||||
this.minGB = ""
|
||||
this.minSize = ""
|
||||
|
||||
this.maxGB = ""
|
||||
this.maxSize = ""
|
||||
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
this.$watch("minGB", function (v) {
|
||||
v = parseInt(v)
|
||||
if (isNaN(v) || v <= 0) {
|
||||
that.minSize = ""
|
||||
} else {
|
||||
that.minSize = teaweb.formatBytes(v * Math.pow(1024, 3))
|
||||
}
|
||||
})
|
||||
this.$watch("maxGB", function (v) {
|
||||
v = parseInt(v)
|
||||
if (isNaN(v) || v < 0) {
|
||||
that.maxSize = ""
|
||||
} else if (v == 0) {
|
||||
that.maxSize = "∞"
|
||||
} else {
|
||||
that.maxSize = teaweb.formatBytes(v * Math.pow(1024, 3))
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
h3 var {
|
||||
font-style: normal;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>修改带宽区间</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="itemId" :value="item.id"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="100" ref="focus" v-model="item.name"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>最低带宽 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="minMB" maxlength="12" style="width:10em" v-model="minMB" autocomplete="off"/>
|
||||
<span class="ui label">Mbps</span>
|
||||
</div>
|
||||
<p class="comment">使用比特作为最小单位。<span v-if="minSize.length > 0">相当于:{{minSize}}。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>最高带宽 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="maxMB" maxlength="12" style="width:10em" v-model="maxMB" autocomplete="off"/>
|
||||
<span class="ui label">Mbps</span>
|
||||
</div>
|
||||
<p class="comment">使用比特作为最小单位,0表示没有限制。<span v-if="maxSize.length > 0">相当于:{{maxSize}}。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,32 @@
|
||||
Tea.context(function () {
|
||||
this.minMB = 0
|
||||
this.minSize = ""
|
||||
|
||||
this.maxMB = 0
|
||||
this.maxSize = ""
|
||||
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
this.$watch("minMB", function (v) {
|
||||
v = parseInt(v)
|
||||
if (isNaN(v) || v <= 0) {
|
||||
that.minSize = ""
|
||||
} else {
|
||||
that.minSize = teaweb.formatBits(v * Math.pow(1024, 2))
|
||||
}
|
||||
})
|
||||
this.$watch("maxMB", function (v) {
|
||||
v = parseInt(v)
|
||||
if (isNaN(v) || v < 0) {
|
||||
that.maxSize = ""
|
||||
} else if (v == 0) {
|
||||
that.maxSize = "∞"
|
||||
} else {
|
||||
that.maxSize = teaweb.formatBits(v * Math.pow(1024, 2))
|
||||
}
|
||||
})
|
||||
|
||||
this.minMB = this.item.minMB
|
||||
this.maxMB = this.item.maxMB
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,37 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>修改流量区间</h3>
|
||||
|
||||
<form class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="itemId" :value="item.id"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="100" ref="focus" v-model="item.name"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>最低流量 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="minGB" maxlength="12" style="width:10em" v-model="minGB" autocomplete="off"/>
|
||||
<span class="ui label">GiB</span>
|
||||
</div>
|
||||
<p class="comment">使用字节作为最小单位。<span v-if="minSize.length > 0">相当于:{{minSize}}。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>最高流量 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="maxGB" maxlength="12" style="width:10em" v-model="maxGB" autocomplete="off"/>
|
||||
<span class="ui label">GiB</span>
|
||||
</div>
|
||||
<p class="comment">使用字节作为最小单位,0表示没有限制。<span v-if="maxSize.length > 0">相当于:{{maxSize}}。</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,32 @@
|
||||
Tea.context(function () {
|
||||
this.minGB = 0
|
||||
this.minSize = ""
|
||||
|
||||
this.maxGB = 0
|
||||
this.maxSize = ""
|
||||
|
||||
this.$delay(function () {
|
||||
let that = this
|
||||
this.$watch("minGB", function (v) {
|
||||
v = parseInt(v)
|
||||
if (isNaN(v) || v <= 0) {
|
||||
that.minSize = ""
|
||||
} else {
|
||||
that.minSize = teaweb.formatBytes(v * Math.pow(1024, 3))
|
||||
}
|
||||
})
|
||||
this.$watch("maxGB", function (v) {
|
||||
v = parseInt(v)
|
||||
if (isNaN(v) || v < 0) {
|
||||
that.maxSize = ""
|
||||
} else if (v == 0) {
|
||||
that.maxSize = "∞"
|
||||
} else {
|
||||
that.maxSize = teaweb.formatBytes(v * Math.pow(1024, 3))
|
||||
}
|
||||
})
|
||||
|
||||
this.minGB = this.item.minGB
|
||||
this.maxGB = this.item.maxGB
|
||||
})
|
||||
})
|
||||
20
EdgeAdmin/web/views/@default/finance/fee/traffic.css
Normal file
20
EdgeAdmin/web/views/@default/finance/fee/traffic.css
Normal file
@@ -0,0 +1,20 @@
|
||||
th span {
|
||||
font-size: 0.9em;
|
||||
font-weight: normal;
|
||||
color: grey;
|
||||
}
|
||||
th a {
|
||||
font-weight: normal;
|
||||
visibility: hidden;
|
||||
}
|
||||
th:hover a {
|
||||
visibility: visible;
|
||||
}
|
||||
td a {
|
||||
visibility: hidden;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
td:hover a {
|
||||
visibility: visible;
|
||||
}
|
||||
/*# sourceMappingURL=prices.css.map */
|
||||
1
EdgeAdmin/web/views/@default/finance/fee/traffic.css.map
Normal file
1
EdgeAdmin/web/views/@default/finance/fee/traffic.css.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["prices.less"],"names":[],"mappings":"AAAA,EACC;EACC,gBAAA;EACA,mBAAA;EACA,WAAA;;AAJF,EAOC;EACC,mBAAA;EACA,kBAAA;;AAIF,EAAE,MACD;EACC,mBAAA;;AAIF,EACC;EACC,kBAAA;EACA,gBAAA;;AAIF,EAAE,MACD;EACC,mBAAA","file":"prices.css"}
|
||||
40
EdgeAdmin/web/views/@default/finance/fee/traffic.html
Normal file
40
EdgeAdmin/web/views/@default/finance/fee/traffic.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{$layout}
|
||||
{$template "menu"}
|
||||
|
||||
<div class="ui message warning" v-if="config.trafficPrice != null && !config.trafficPrice.supportRegions">
|
||||
尚未开启按区域流量计费。 <a href="/finance/fee">[修改]</a>
|
||||
</div>
|
||||
|
||||
<p class="comment" v-if="regions.length == 0">暂时还没有区域。</p>
|
||||
|
||||
<table class="ui table selectable small definition celled" v-if="regions.length > 0">
|
||||
<thead class="full-width">
|
||||
<tr>
|
||||
<th class="three wide">区域\流量区间</th>
|
||||
<th v-for="item in items" class="center">
|
||||
{{item.name}}
|
||||
<br/>
|
||||
<span>{{item.minSize}}-{{item.maxSize}}</span>
|
||||
<br/>
|
||||
<a href="" title="修改" @click.prevent="updateItem(item.id)"><i class="icon pencil small"></i></a>
|
||||
<a href="" title="删除" @click.prevent="deleteItem(item.id)"><i class="icon remove small"></i></a>
|
||||
</th>
|
||||
<th class="width10 center">
|
||||
<a href="" @click.prevent="createItem" style="visibility: visible">[+添加流量区间]</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="region in regions">
|
||||
<td class="">{{region.name}}</td>
|
||||
<td v-for="item in items" class="center">
|
||||
<div>
|
||||
<span v-if="region.prices[item.id.toString()] != null">¥{{region.prices[item.id.toString()]}}元/GiB </span>
|
||||
<span v-else> </span>
|
||||
</div>
|
||||
<div>
|
||||
<a href="" title="修改单位价格" @click.prevent="updatePrice(region.id, item.id)">[设置]</a>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
42
EdgeAdmin/web/views/@default/finance/fee/traffic.js
Normal file
42
EdgeAdmin/web/views/@default/finance/fee/traffic.js
Normal file
@@ -0,0 +1,42 @@
|
||||
Tea.context(function () {
|
||||
this.createItem = function () {
|
||||
teaweb.popup(Tea.url(".items.createTrafficPopup"), {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.updateItem = function (itemId) {
|
||||
teaweb.popup(Tea.url(".items.updateTrafficPopup", {itemId: itemId}), {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteItem = function (itemId) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此流量区间吗?", function () {
|
||||
that.$post(".items.delete")
|
||||
.params({
|
||||
itemId: itemId
|
||||
})
|
||||
.refresh()
|
||||
})
|
||||
}
|
||||
|
||||
this.updatePrice = function (regionId, itemId) {
|
||||
teaweb.popup(Tea.url(".updatePricePopup", {regionId: regionId, itemId: itemId}), {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
31
EdgeAdmin/web/views/@default/finance/fee/traffic.less
Normal file
31
EdgeAdmin/web/views/@default/finance/fee/traffic.less
Normal file
@@ -0,0 +1,31 @@
|
||||
th {
|
||||
span {
|
||||
font-size: 0.9em;
|
||||
font-weight: normal;
|
||||
color: grey;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: normal;
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
th:hover {
|
||||
a {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
a {
|
||||
visibility: hidden;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
}
|
||||
|
||||
td:hover {
|
||||
a {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3 v-if="item.type == 'traffic'">修改流量价格</h3>
|
||||
<h3 v-if="item.type == 'bandwidth'">修改带宽价格</h3>
|
||||
<form class="ui form" method="post" data-tea-action="$" data-tea-success="success">
|
||||
<csrf-token></csrf-token>
|
||||
<input type="hidden" name="regionId" :value="region.id"/>
|
||||
<input type="hidden" name="itemId" :value="item.id"/>
|
||||
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">区域</td>
|
||||
<td>{{region.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>价格项名称</td>
|
||||
<td>{{item.name}}</td>
|
||||
</tr>
|
||||
<tr v-show="item.type == 'traffic'">
|
||||
<td>流量范围</td>
|
||||
<td>{{item.minSize}} - {{item.maxSize}}</td>
|
||||
</tr>
|
||||
<tr v-show="item.type == 'bandwidth'">
|
||||
<td>带宽范围</td>
|
||||
<td>{{item.minSize}} - {{item.maxSize}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">单位价格 *</td>
|
||||
<td>
|
||||
<div class="ui input right labeled">
|
||||
<input type="text" name="price" maxlength="10" style="width:6em" ref="focus" v-model="price"/>
|
||||
<span class="ui label" v-if="item.type == 'traffic'">元/GiB</span>
|
||||
<span class="ui label" v-if="item.type == 'bandwidth'">元/Mbps</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
Reference in New Issue
Block a user