function ChargeParamComponent(option) {
var _el = option.el;
var _powerStep = option.powerStep;
var _consumeType = option.consumeType;
var _billingType = option.billingType;
var app = this.app = new Vue({
el: _el,
template: `
`
,
data: {
info: {
consumeType: null,
billingType: null,
powerStep: [],
edit: false,
curPower: 0,
curRatio: 0,
curIndex: 0
},
},
mounted: function () {
var that = this;
that.initPackages();
},
methods: {
initPackages: function () {
this.info.powerStep = _powerStep;
this.info.consumeType = _consumeType;
this.info.billingType = _billingType;
},
editPackageRule: function (obj, index) {
this.info.curPower = obj.power;
this.info.curRatio = obj.ratio;
this.info.curIndex = index;
this.info.edit = true
},
closeRulePanel: function (){
this.info.edit = false
},
saveRule: function (){
var obj = {}
obj.power = this.info.curPower;
obj.ratio = this.info.curRatio;
this.info.powerStep[Number(this.info.curIndex)] = obj;
console.log(this.info.curIndex)
this.closeRulePanel()
}
}
});
}
// 获取获取功率计费
ChargeParamComponent.prototype.getPowerStep = function () {
return this.app.info.powerStep;
};
ChargeParamComponent.prototype.getConsumeType = function () {
return this.app.info.consumeType;
};
ChargeParamComponent.prototype.getBillingType = function () {
return this.app.info.billingType;
};