|
@@ -1,48 +1,50 @@
|
|
|
<template>
|
|
|
- <view>
|
|
|
- <u-navbar title="车辆管理"></u-navbar>
|
|
|
- <view class="carDet">
|
|
|
- <ucarkeyboard ref="uKeyboard" mode="car" v-model="keyShow" @change="valChange" @backspace="backspace"></ucarkeyboard>
|
|
|
- <u-message-input maxlength="8" ></u-message-input>
|
|
|
+ <view class="wrap">
|
|
|
+ <u-navbar title="添加车牌"></u-navbar>
|
|
|
+ <view class="key-input">
|
|
|
+ <u-message-input :focus="true" :value="form.carNum" :maxlength="maxlength" :disabled-keyboard="true"></u-message-input>
|
|
|
+ </view>
|
|
|
+ <ucarkeyboard ref="uKeyboard" mode="car" :showTips="true" :confirmBtn="false" :tooltip="false" v-model="keyShow" @change="valChange" @backspace="backspace"></ucarkeyboard>
|
|
|
+ <view class="default">
|
|
|
<u-checkbox-group>
|
|
|
- <u-checkbox active-color="#0076FF" v-model="form.defaultFlag" shape="circle" @change="checkboxChange()">设为默认车辆</u-checkbox>
|
|
|
+ <u-checkbox class="tips" v-model="form.defaultFlag" shape="circle" @change="checkboxChange()">设为默认车辆</u-checkbox>
|
|
|
</u-checkbox-group>
|
|
|
</view>
|
|
|
- <u-button class="login-btn" type="success" shape="circle" @click="keepCar">保存</u-button>
|
|
|
+ <u-button class="login-btn" type="success" shape="circle" @click="sure">保存</u-button>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import * as userApi from '@/apis/user.js'
|
|
|
import ucarkeyboard from '@/components/Ucarkeyboard.vue'
|
|
|
-
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
ucarkeyboard
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- keyShow: false,
|
|
|
+ maxlength:8,
|
|
|
+ keyShow: true,
|
|
|
form: {
|
|
|
- carNum: '',
|
|
|
+ carNum: '鄂',
|
|
|
defaultFlag: true,
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
onLoad(op) {
|
|
|
- if(op.id){
|
|
|
- var str1 = op.id.slice(0,19);
|
|
|
- var str2 = op.id.slice(20,21);
|
|
|
+ if (op.id) {
|
|
|
+ var str1 = op.id.slice(0, 19);
|
|
|
+ var str2 = op.id.slice(20, 21);
|
|
|
var str3 = op.id.slice(22);
|
|
|
-
|
|
|
- if(str1 == 'jp_team51_charge_id') {
|
|
|
- if(str2 == 'A') {
|
|
|
+
|
|
|
+ if (str1 == 'jp_team51_charge_id') {
|
|
|
+ if (str2 == 'A') {
|
|
|
this.code = str2;
|
|
|
this.codeId = str3;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
checkboxChange() {
|
|
@@ -53,23 +55,23 @@
|
|
|
// 将每次按键的值拼接到form.carNum变量中,注意+=写法
|
|
|
this.form.carNum += val;
|
|
|
console.log(this.form.carNum);
|
|
|
- this.$refs.uKeyboard.changeCarInputMode()
|
|
|
+ // this.$refs.uKeyboard.changeCarInputMode()
|
|
|
},
|
|
|
// 退格键被点击
|
|
|
backspace() {
|
|
|
// 删除form.carNum的最后一个字符
|
|
|
- if(this.form.carNum.length) this.form.carNum = this.form.carNum.substr(0, this.form.carNum.length - 1);
|
|
|
+ if (this.form.carNum.length) this.form.carNum = this.form.carNum.substr(0, this.form.carNum.length - 1);
|
|
|
console.log(this.form.carNum);
|
|
|
},
|
|
|
keepCar() {
|
|
|
uni.showLoading({
|
|
|
title: "加载中",
|
|
|
mask: true,
|
|
|
- })
|
|
|
+ })
|
|
|
userApi.addRegUserCar(this.form).then((res) => {
|
|
|
- uni.hideLoading();
|
|
|
-
|
|
|
- if(this.code == 'A') {
|
|
|
+ uni.hideLoading();
|
|
|
+
|
|
|
+ if (this.code == 'A') {
|
|
|
uni.navigateBack({
|
|
|
url: '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + this.codeId
|
|
|
})
|
|
@@ -89,22 +91,29 @@
|
|
|
}
|
|
|
</script>
|
|
|
<style>
|
|
|
- page{
|
|
|
- background: #fff;
|
|
|
+ page {
|
|
|
+ background-color: #fff;
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="scss" scoped>
|
|
|
- .slot-wrap{
|
|
|
- flex: 1;
|
|
|
+ /deep/.u-char-item {
|
|
|
+ width: 32px !important;
|
|
|
+ height: 40px !important;
|
|
|
+ font-size: 18px !important;
|
|
|
}
|
|
|
- .carDet{
|
|
|
- padding: 0 16px;
|
|
|
+
|
|
|
+ .key-input {
|
|
|
+ padding-top: 24px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .default {
|
|
|
+ margin: 16px 28px;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
.login-btn {
|
|
|
- margin: 28px ;
|
|
|
- background-color:#00B962!important;
|
|
|
- border-color: #00B962!important;
|
|
|
- color:#fff!important;
|
|
|
+ margin: 28px;
|
|
|
+ background-color: #00B962 !important;
|
|
|
+ border-color: #00B962 !important;
|
|
|
+ color: #fff !important;
|
|
|
}
|
|
|
</style>
|