diff --git a/web/public/js/components.js b/web/public/js/components.js
index 8af13613..133996ee 100755
--- a/web/public/js/components.js
+++ b/web/public/js/components.js
@@ -1370,25 +1370,182 @@ Vue.component("plan-price-view", {
},
template: `
- 月度:¥{{plan.monthlyPrice}}元
- 季度:¥{{plan.seasonallyPrice}}元
- 年度:¥{{plan.yearlyPrice}}元
+ 按时间周期计费
+
+
+ 月度:¥{{plan.monthlyPrice}}元
+ 季度:¥{{plan.seasonallyPrice}}元
+ 年度:¥{{plan.yearlyPrice}}元
+
+
- 基础价格:¥{{plan.trafficPrice.base}}元/GB
+ 按流量计费
+
+ 基础价格:¥{{plan.trafficPrice.base}}元/GB
+
+
+ 按{{plan.bandwidthPrice.percentile}}th带宽计费
+
+
+ {{range.minMB}} - {{range.maxMB}}MB∞: {{range.pricePerMB}}元/MB
+
+
+
+
`
+})
+
+Vue.component("plan-bandwidth-ranges", {
+ props: ["v-ranges"],
+ data: function () {
+ let ranges = this.vRanges
+ if (ranges == null) {
+ ranges = []
+ }
+ return {
+ ranges: ranges,
+ isAdding: false,
+
+ minMB: "",
+ maxMB: "",
+ pricePerMB: "",
+ addingRange: {
+ minMB: 0,
+ maxMB: 0,
+ pricePerMB: 0,
+ totalPrice: 0
+ }
+ }
+ },
+ methods: {
+ add: function () {
+ this.isAdding = !this.isAdding
+ let that = this
+ setTimeout(function () {
+ that.$refs.minMB.focus()
+ })
+ },
+ cancelAdding: function () {
+ this.isAdding = false
+ },
+ confirm: function () {
+ this.isAdding = false
+ this.minMB = ""
+ this.maxMB = ""
+ this.pricePerMB = ""
+ this.ranges.push(this.addingRange)
+ this.ranges.$sort(function (v1, v2) {
+ if (v1.minMB < v2.minMB) {
+ return -1
+ }
+ if (v1.minMB == v2.minMB) {
+ return 0
+ }
+ return 1
+ })
+ this.change()
+ this.addingRange = {
+ minMB: 0,
+ maxMB: 0,
+ pricePerMB: 0,
+ totalPrice: 0
+ }
+ },
+ remove: function (index) {
+ this.ranges.$remove(index)
+ this.change()
+ },
+ change: function () {
+ this.$emit("change", this.ranges)
+ }
+ },
+ watch: {
+ minMB: function (v) {
+ let minMB = parseInt(v.toString())
+ if (isNaN(minMB) || minMB < 0) {
+ minMB = 0
+ }
+ this.addingRange.minMB = minMB
+ },
+ maxMB: function (v) {
+ let maxMB = parseInt(v.toString())
+ if (isNaN(maxMB) || maxMB < 0) {
+ maxMB = 0
+ }
+ this.addingRange.maxMB = maxMB
+ },
+ pricePerMB: function (v) {
+ let pricePerMB = parseFloat(v.toString())
+ if (isNaN(pricePerMB) || pricePerMB < 0) {
+ pricePerMB = 0
+ }
+ this.addingRange.pricePerMB = pricePerMB
+ }
+ },
+ template: `
+
+
+
+ {{range.minMB}}MB -
{{range.maxMB}}MB∞ 价格:{{range.pricePerMB}}元/MB
+
+
+
+
+
+
+
+
+
+
+
+
`
})
// 套餐价格配置
Vue.component("plan-price-config-box", {
- props: ["v-price-type", "v-monthly-price", "v-seasonally-price", "v-yearly-price", "v-traffic-price"],
+ props: ["v-price-type", "v-monthly-price", "v-seasonally-price", "v-yearly-price", "v-traffic-price", "v-bandwidth-price", "v-disable-period"],
data: function () {
let priceType = this.vPriceType
if (priceType == null) {
- priceType = "period"
+ priceType = "bandwidth"
}
+ // 按时间周期计费
let monthlyPriceNumber = 0
let monthlyPrice = this.vMonthlyPrice
if (monthlyPrice == null || monthlyPrice <= 0) {
@@ -1425,6 +1582,7 @@ Vue.component("plan-price-config-box", {
}
}
+ // 按流量计费
let trafficPrice = this.vTrafficPrice
let trafficPriceBaseNumber = 0
if (trafficPrice != null) {
@@ -1439,6 +1597,17 @@ Vue.component("plan-price-config-box", {
trafficPriceBase = trafficPriceBaseNumber.toString()
}
+ // 按带宽计费
+ let bandwidthPrice = this.vBandwidthPrice
+ if (bandwidthPrice == null) {
+ bandwidthPrice = {
+ percentile: 95,
+ ranges: []
+ }
+ } else if (bandwidthPrice.ranges == null) {
+ bandwidthPrice.ranges = []
+ }
+
return {
priceType: priceType,
monthlyPrice: monthlyPrice,
@@ -1450,7 +1619,15 @@ Vue.component("plan-price-config-box", {
yearlyPriceNumber: yearlyPriceNumber,
trafficPriceBase: trafficPriceBase,
- trafficPrice: trafficPrice
+ trafficPrice: trafficPrice,
+
+ bandwidthPrice: bandwidthPrice,
+ bandwidthPercentile: bandwidthPrice.percentile
+ }
+ },
+ methods: {
+ changeBandwidthPriceRanges: function (ranges) {
+ this.bandwidthPrice.ranges = ranges
}
},
watch: {
@@ -1481,6 +1658,15 @@ Vue.component("plan-price-config-box", {
price = 0
}
this.trafficPrice.base = price
+ },
+ bandwidthPercentile: function (v) {
+ let percentile = parseInt(v)
+ if (isNaN(percentile) || percentile <= 0) {
+ percentile = 95
+ } else if (percentile > 100) {
+ percentile = 100
+ }
+ this.bandwidthPrice.percentile = percentile
}
},
template: `
@@ -1489,10 +1675,12 @@ Vue.component("plan-price-config-box", {
+
- 按时间周期
- 按流量
+ 按带宽
+ 按流量
+ 按时间周期
@@ -1534,7 +1722,7 @@ Vue.component("plan-price-config-box", {
+
+
+
`
})
@@ -1647,7 +1857,7 @@ Vue.component("http-request-conds-box", {
| 分组{{groupIndex+1}} |
-
+ |
{{cond.param}} {{cond.operator}}
|