// 套餐价格配置 Vue.component("plan-price-config-box", { 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 = "bandwidth" } // 按时间周期计费 let monthlyPriceNumber = 0 let monthlyPrice = this.vMonthlyPrice if (monthlyPrice == null || monthlyPrice <= 0) { monthlyPrice = "" } else { monthlyPrice = monthlyPrice.toString() monthlyPriceNumber = parseFloat(monthlyPrice) if (isNaN(monthlyPriceNumber)) { monthlyPriceNumber = 0 } } let seasonallyPriceNumber = 0 let seasonallyPrice = this.vSeasonallyPrice if (seasonallyPrice == null || seasonallyPrice <= 0) { seasonallyPrice = "" } else { seasonallyPrice = seasonallyPrice.toString() seasonallyPriceNumber = parseFloat(seasonallyPrice) if (isNaN(seasonallyPriceNumber)) { seasonallyPriceNumber = 0 } } let yearlyPriceNumber = 0 let yearlyPrice = this.vYearlyPrice if (yearlyPrice == null || yearlyPrice <= 0) { yearlyPrice = "" } else { yearlyPrice = yearlyPrice.toString() yearlyPriceNumber = parseFloat(yearlyPrice) if (isNaN(yearlyPriceNumber)) { yearlyPriceNumber = 0 } } // 按流量计费 let trafficPrice = this.vTrafficPrice let trafficPriceBaseNumber = 0 if (trafficPrice != null) { trafficPriceBaseNumber = trafficPrice.base } else { trafficPrice = { base: 0 } } let trafficPriceBase = "" if (trafficPriceBaseNumber > 0) { 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, seasonallyPrice: seasonallyPrice, yearlyPrice: yearlyPrice, monthlyPriceNumber: monthlyPriceNumber, seasonallyPriceNumber: seasonallyPriceNumber, yearlyPriceNumber: yearlyPriceNumber, trafficPriceBase: trafficPriceBase, trafficPrice: trafficPrice, bandwidthPrice: bandwidthPrice, bandwidthPercentile: bandwidthPrice.percentile } }, methods: { changeBandwidthPriceRanges: function (ranges) { this.bandwidthPrice.ranges = ranges } }, watch: { monthlyPrice: function (v) { let price = parseFloat(v) if (isNaN(price)) { price = 0 } this.monthlyPriceNumber = price }, seasonallyPrice: function (v) { let price = parseFloat(v) if (isNaN(price)) { price = 0 } this.seasonallyPriceNumber = price }, yearlyPrice: function (v) { let price = parseFloat(v) if (isNaN(price)) { price = 0 } this.yearlyPriceNumber = price }, trafficPriceBase: function (v) { let price = parseFloat(v) if (isNaN(price)) { 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: `
| 月度价格 |
元
|
| 季度价格 |
元
|
| 年度价格 |
元
|
| 基础流量费用 * |
元/GB
|
| 带宽百分位 * |
th
|
| 带宽价格 |
|