123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- 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: `
- <div>
- <div class="mui-input-group">
- <div class="mui-input-row mui-radio">
- <label class="tips-event">
- 先按键
- <i class="tips" title="先按下按键,然后再刷卡或者投币">?</i>
- </label>
- <input id="consumeType1" v-model="info.consumeType" name="consumeType" value="1" type="radio">
- </div>
-
- <div class="mui-input-row mui-radio">
- <label class="tips-event">
- 后按键
- <i class="tips" title="先刷卡或者投币,然后按下按键启动">?</i>
- </label>
- <input id="consumeType2" v-model="info.consumeType" name="consumeType" value="0" type="radio">
- </div>
- </div>
-
- <div class="mui-input-group">
- <div class="mui-input-row mui-radio">
- <label class="tips-event">
- 线上计费
- <i class="tips" title="该模式下,由套餐设置中选择的计费模式进行控制计费">?</i>
- </label>
- <input id="billingType1" v-model="info.billingType" name="billingType" value="2" type="radio" checked="checked" readonly="readonly">
- </div>
- </div>
-
- <div class="edit-back packageDialog" v-if="info.edit">
- <div class="edit-content">
- <div class="edit-box ">
- <template>
- <div class="mui-input-row">
- <label>功率</label>
- <div class="mui-pull-right edit-row">
- <input type="number" min="0" max="999" v-model="info.curPower"/>
- <span>瓦</span>
- </div>
- </div>
-
- <div class="mui-input-row ">
- <label>比例</label>
- <div class="mui-pull-right edit-row">
- <input type="number" min="0" max="100" v-model="info.curRatio"/>
- <span>%</span>
- </div>
- </div>
- </template>
-
- </div>
- <div class="mui-popup-buttons ">
- <span class="mui-popup-button" v-on:click="closeRulePanel()">取消</span>
- <span class="mui-popup-button mui-popup-button-bold" v-on:click="saveRule()">确认</span>
- </div>
- </div>
- </div>
-
- </div>
- `
- ,
- 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;
- };
|