Blame view

src/views/parkPay/recharge.vue 2.14 KB
93f2f8b2   刘淇   西城购买月卡
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  <template>
    <div>
      <div class="rechargeImg"></div>
  
      <p class="balanceTitle">车牌余额: {{(balance/100).toFixed(2)}}元</p>
  
      <div style="display: flex;padding: 15px;background: #e6fafa">
  
        <p style="width: 40%">请输入充值金额</p>
        <input
          class="keep_input"
          v-number-only
          style="width:60%"
          maxlength="5"
          v-model="fileOrder"
          @input="fileOrder = Number($event.target.value.replace(/\D+/, ''))"
        />
  
      </div>
  
  
      <div class="submit-box" @click="toRecharge">
        确定充值
      </div>
    </div>
  </template>
  
  <script>
  export default {
    name: "recharge",
    data() {
      return {
        balance: "20",
        fileOrder: 100
      };
    },
    directives: {
      numberOnly: {
        bind: function(el) {
          el.handler = function() {
            el.value = Number(el.value.replace(/\D+/, ''))
          }
          el.addEventListener('input', el.handler)
        },
        unbind: function(el) {
          el.removeEventListener('input', el.handler)
        }
      }
    },
  };
  </script>
  
  <style scoped>
    .rechargeImg{
      width: 80px;
      height: 80px;
      margin: 20px auto;
      background: url("../../assets/images/recharge.png");
    }
    .balanceTitle {
      padding: 15px;
      background: #ccc;
      font-size: 16px;
      /*color: #fff;*/
    }
  
    .submit-box {
      width: 80%;
      height: 44px;
      line-height: 44px;
      border-radius: 4px;
      font-size: 20px;
      margin: 58px auto 0;
      background: linear-gradient(180deg, #3885D9 0%, #4194EF 100%);
      color: #fff;
      text-align: center;
    }
    .keep_input {
      -webkit-appearance: none;
      background-color: #fff;
      background-image: none;
      border-radius: 4px;
      border: 1px solid #dcdfe6;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      color: #606266;
      display: inline-block;
      font-size: inherit;
      outline: 0;
      padding: 0 15px;
      -webkit-transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
      transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
      height: 30px;
      line-height: 30px;
      text-align: left;
    }
    .keep_input:focus {
      border-color: #54a6de;
      outline: 0;
    }
  </style>