Blame view

src/views/mycar/index.vue 4.54 KB
613d2a9c   Andy   add icon
1
  <template>
ec35bad6   Andy   add 账户设置 前端页面
2
    <div>
613d2a9c   Andy   add icon
3
  
ec35bad6   Andy   add 账户设置 前端页面
4
5
6
7
      <div class="search-wrap">
        <el-row :gutter="20">
          <el-form ref="form" :model="form" label-width="60px" label-position="left">
            <el-col :xs="8" :sm="6" :md="7" :lg="7" :xl="1">
ea291b39   王富生   提交登陆
8
9
10
11
12
13
14
              <el-form-item label="账户ID">
                <el-input v-model="form.custId" maxlength="20" :disabled="true"/>
              </el-form-item>
            </el-col>
            <el-col :xs="8" :sm="6" :md="7" :lg="7" :xl="1" :offset="8">
              <el-form-item label="手机号">
                <el-input v-model="form.phone" maxlength="20" :disabled="true"/>
ec35bad6   Andy   add 账户设置 前端页面
15
16
17
18
19
              </el-form-item>
            </el-col>
          </el-form>
        </el-row>
      </div>
ea291b39   王富生   提交登陆
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
      <el-row :gutter="20" style="margin-top: 8px">
        <el-col :span="12">
          <el-card class="box-card" style="height: 300px">
            <div slot="header" class="clearfix">
              <span>车牌绑定</span>
            </div>
            <el-form ref="bondform" :model="bondform" label-width="60px" label-position="left" :rules="rules">
              <el-row :gutter="20">
                <el-col :span="12">
                  <el-form-item label="车牌号" prop="carNum">
                    <el-input type="text" v-model="bondform.carNum"/>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-button type="primary" :loading="bondformBtnVisible" @click="bondCarNum('bondform')">绑定车牌</el-button>
                </el-col>
              </el-row>
  
            </el-form>
  
          </el-card>
        </el-col>
        <el-col :span="12">
          <el-card class="box-card" style="height: 300px">
            <div slot="header" class="clearfix">
              <span>解绑车牌</span>
            </div>
            <el-form ref="form" :model="form" label-width="60px" label-position="left">
              <el-row :gutter="20" v-for="item in alredyBoundCar" style="margin-top: 4px">
                <el-col :span="12">
                  <el-form-item label="已绑车牌">
                    <el-input  :value="item.carNumber"/>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-button type="primary" @click="alredyBoundCarBtn(item.carNumber)">解绑车牌</el-button>
                </el-col>
              </el-row>
  
            </el-form>
  
          </el-card>
        </el-col>
      </el-row>
  
613d2a9c   Andy   add icon
65
  
613d2a9c   Andy   add icon
66
67
68
69
    </div>
  </template>
  
  <script>
ea291b39   王富生   提交登陆
70
    import {getPersonCarNumPC} from '@/api/mycar.js';
613d2a9c   Andy   add icon
71
    export default {
613d2a9c   Andy   add icon
72
      data() {
ea291b39   王富生   提交登陆
73
74
75
76
77
78
79
80
81
82
83
        var carNumValidator = (rule, value, callback) => {
          if (value === '') {
            callback(new Error('请输入车牌号'));
          }
  
          if ( !/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/.test(this.bondform.carNum)||this.bondform.carNum.length<8) {
            callback(new Error('请输入正确的车牌号'));
          }
          callback();
  
        };
613d2a9c   Andy   add icon
84
        return {
ec35bad6   Andy   add 账户设置 前端页面
85
          form: {
ea291b39   王富生   提交登陆
86
87
            custId: '',
            phone: ''
ec35bad6   Andy   add 账户设置 前端页面
88
          },
ea291b39   王富生   提交登陆
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
          /**绑定车牌.*/
          bondform: {
            carNum: ''
          },
  
          /**已绑定车牌.*/
          alredyBoundCar:[],
          bondformBtnVisible: false,
          dialogFormVisible: false,
          problemform: {
            carnum: '',
          },
          rules:{
            carNum:[{ validator: carNumValidator, trigger: 'blur' }]
            }
613d2a9c   Andy   add icon
104
        }
ea291b39   王富生   提交登陆
105
106
  
  
613d2a9c   Andy   add icon
107
      },
613d2a9c   Andy   add icon
108
      methods: {
ea291b39   王富生   提交登陆
109
110
111
112
113
114
115
116
117
        /**绑定车牌*/
        bondCarNum:function(formName){
          this.$refs[formName].validate((valid) => {
            if (valid) {
              alert('submit!');
            } else {
              console.log('error submit!!');
              return false;
            }
ec35bad6   Andy   add 账户设置 前端页面
118
119
          });
        },
ea291b39   王富生   提交登陆
120
121
122
123
124
125
126
127
128
        /**获取车牌.*/
        getPersonCarNumPC:function () {
          let that =this;
          getPersonCarNumPC().then(response =>{
  
            if(response.code ='8888'){
              that.alredyBoundCar=response.data;
            }
          });
ec35bad6   Andy   add 账户设置 前端页面
129
        },
ea291b39   王富生   提交登陆
130
131
132
133
134
135
136
137
138
139
140
141
        /**解绑车牌.*/
        alredyBoundCarBtn:function (carNum) {
             debugger
        }
      },
      mounted:function(){
        let userInfo = this.$store.state.user.userInfo;
        this.form={
          custId: userInfo.custId,
            phone: userInfo.userPhone
        };
        this.getPersonCarNumPC();
613d2a9c   Andy   add icon
142
143
144
145
      }
    }
  </script>
  
ec35bad6   Andy   add 账户设置 前端页面
146
  <style lang="scss">
ea291b39   王富生   提交登陆
147
    .search-wrap {
ec35bad6   Andy   add 账户设置 前端页面
148
149
150
      background-color: #FFF;
      padding: 15px;
    }
ea291b39   王富生   提交登陆
151
152
  
    .card-second-top {
ec35bad6   Andy   add 账户设置 前端页面
153
154
      margin-top: 15px;
    }
ea291b39   王富生   提交登陆
155
156
  
    .el-card__header {
ec35bad6   Andy   add 账户设置 前端页面
157
158
      padding: 10px 20px;
    }
ea291b39   王富生   提交登陆
159
160
  
    .el-radio {
ec35bad6   Andy   add 账户设置 前端页面
161
162
      margin-right: 80px;
    }
ea291b39   王富生   提交登陆
163
164
  
    .el-radio.is-bordered + .el-radio.is-bordered {
ec35bad6   Andy   add 账户设置 前端页面
165
166
167
168
      margin-left: 0px;
      margin-top: 15px;
    }
  </style>