device-param-101281.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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="billingType1" v-model="info.billingType" name="billingType" value="2" type="radio" checked="checked" readonly="readonly">
  33. </div>
  34. </div>
  35. <div class="edit-back packageDialog" v-if="info.edit">
  36. <div class="edit-content">
  37. <div class="edit-box ">
  38. <template>
  39. <div class="mui-input-row">
  40. <label>功率</label>
  41. <div class="mui-pull-right edit-row">
  42. <input type="number" min="0" max="999" v-model="info.curPower"/>
  43. <span>瓦</span>
  44. </div>
  45. </div>
  46. <div class="mui-input-row ">
  47. <label>比例</label>
  48. <div class="mui-pull-right edit-row">
  49. <input type="number" min="0" max="100" v-model="info.curRatio"/>
  50. <span>%</span>
  51. </div>
  52. </div>
  53. </template>
  54. </div>
  55. <div class="mui-popup-buttons ">
  56. <span class="mui-popup-button" v-on:click="closeRulePanel()">取消</span>
  57. <span class="mui-popup-button mui-popup-button-bold" v-on:click="saveRule()">确认</span>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. `
  63. ,
  64. data: {
  65. info: {
  66. consumeType: null,
  67. billingType: null,
  68. powerStep: [],
  69. edit: false,
  70. curPower: 0,
  71. curRatio: 0,
  72. curIndex: 0
  73. },
  74. },
  75. mounted: function () {
  76. var that = this;
  77. that.initPackages();
  78. },
  79. methods: {
  80. initPackages: function () {
  81. this.info.powerStep = _powerStep;
  82. this.info.consumeType = _consumeType;
  83. this.info.billingType = _billingType;
  84. },
  85. editPackageRule: function (obj, index) {
  86. this.info.curPower = obj.power;
  87. this.info.curRatio = obj.ratio;
  88. this.info.curIndex = index;
  89. this.info.edit = true
  90. },
  91. closeRulePanel: function (){
  92. this.info.edit = false
  93. },
  94. saveRule: function (){
  95. var obj = {}
  96. obj.power = this.info.curPower;
  97. obj.ratio = this.info.curRatio;
  98. this.info.powerStep[Number(this.info.curIndex)] = obj;
  99. console.log(this.info.curIndex)
  100. this.closeRulePanel()
  101. }
  102. }
  103. });
  104. }
  105. // 获取获取功率计费
  106. ChargeParamComponent.prototype.getPowerStep = function () {
  107. return this.app.info.powerStep;
  108. };
  109. ChargeParamComponent.prototype.getConsumeType = function () {
  110. return this.app.info.consumeType;
  111. };
  112. ChargeParamComponent.prototype.getBillingType = function () {
  113. return this.app.info.billingType;
  114. };