device-param-100281.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. function ChargeParamComponent(option) {
  2. var _el = option.el;
  3. var _powerStep = option.powerStep;
  4. var _consumeType = option.consumeType;
  5. var _billingType = option.billingType;
  6. var app = this.app = new Vue({
  7. el: _el,
  8. template: `
  9. <div>
  10. <div class="mui-input-group">
  11. <div class="mui-input-row mui-radio">
  12. <label class="tips-event">
  13. 先按键
  14. <i class="tips" title="先按下按键,然后再刷卡或者投币">?</i>
  15. </label>
  16. <input id="consumeType1" v-model="info.consumeType" name="consumeType" value="1" type="radio">
  17. </div>
  18. <div class="mui-input-row mui-radio">
  19. <label class="tips-event">
  20. 后按键
  21. <i class="tips" title="先刷卡或者投币,然后按下按键启动">?</i>
  22. </label>
  23. <input id="consumeType2" v-model="info.consumeType" name="consumeType" value="0" type="radio">
  24. </div>
  25. </div>
  26. <div class="mui-input-group">
  27. <div class="mui-input-row mui-radio">
  28. <label class="tips-event">
  29. 电量模式计费
  30. <i class="tips" title="该模式下,用户充电按照电量计费">?</i>
  31. </label>
  32. <input id="billingType2" v-model="info.billingType" name="billingType" value="1" type="radio">
  33. </div>
  34. <div class="mui-input-row mui-radio">
  35. <label class="tips-event">
  36. 功率分档计费
  37. <i class="tips" title="该模式下,用户充电按照时间收费,同时会检测用户充电功率,根据功率以及相应功率分档设置动态缩减用户的充电时间">?</i>
  38. </label>
  39. <input id="billingType1" v-model="info.billingType" name="billingType" value="0" type="radio">
  40. </div>
  41. </div>
  42. <div class="mui-input-group" v-if="info.billingType=='0'">
  43. <div class="mui-table-view-cell" v-for="(obj,index) in info.powerStep">
  44. <template>
  45. <span>第{{index+1}}档: </span>
  46. <span>功率:{{obj.power}} w</span>
  47. <span>比例:{{obj.ratio}} %</span>
  48. </template>
  49. <span class="mui-pull-right">
  50. <em v-on:click="editPackageRule(obj,index)" class="padding-t-b-10"><i class="iconfont icon-edit c-primary"></i>编辑</em>
  51. </span>
  52. </div>
  53. </div>
  54. <div class="edit-back packageDialog" v-if="info.edit">
  55. <div class="edit-content">
  56. <div class="edit-box ">
  57. <template>
  58. <div class="mui-input-row">
  59. <label>功率</label>
  60. <div class="mui-pull-right edit-row">
  61. <input type="number" min="0" max="999" v-model="info.curPower"/>
  62. <span>瓦</span>
  63. </div>
  64. </div>
  65. <div class="mui-input-row ">
  66. <label>比例</label>
  67. <div class="mui-pull-right edit-row">
  68. <input type="number" min="0" max="100" v-model="info.curRatio"/>
  69. <span>%</span>
  70. </div>
  71. </div>
  72. </template>
  73. </div>
  74. <div class="mui-popup-buttons ">
  75. <span class="mui-popup-button" v-on:click="closeRulePanel()">取消</span>
  76. <span class="mui-popup-button mui-popup-button-bold" v-on:click="saveRule()">确认</span>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. `
  82. ,
  83. data: {
  84. info: {
  85. consumeType: null,
  86. billingType: null,
  87. powerStep: [],
  88. edit: false,
  89. curPower: 0,
  90. curRatio: 0,
  91. curIndex: 0
  92. },
  93. },
  94. mounted: function () {
  95. var that = this;
  96. that.initPackages();
  97. },
  98. methods: {
  99. initPackages: function () {
  100. this.info.powerStep = _powerStep;
  101. this.info.consumeType = _consumeType;
  102. this.info.billingType = _billingType;
  103. },
  104. editPackageRule: function (obj, index) {
  105. this.info.curPower = obj.power;
  106. this.info.curRatio = obj.ratio;
  107. this.info.curIndex = index;
  108. this.info.edit = true
  109. },
  110. closeRulePanel: function (){
  111. this.info.edit = false
  112. },
  113. saveRule: function (){
  114. var obj = {}
  115. obj.power = this.info.curPower;
  116. obj.ratio = this.info.curRatio;
  117. this.info.powerStep[Number(this.info.curIndex)] = obj;
  118. console.log(this.info.curIndex)
  119. this.closeRulePanel()
  120. }
  121. }
  122. });
  123. }
  124. // 获取获取功率计费
  125. ChargeParamComponent.prototype.getPowerStep = function () {
  126. return this.app.info.powerStep;
  127. };
  128. ChargeParamComponent.prototype.getConsumeType = function () {
  129. return this.app.info.consumeType;
  130. };
  131. ChargeParamComponent.prototype.getBillingType = function () {
  132. return this.app.info.billingType;
  133. };