|
@@ -1,19 +1,90 @@
|
|
|
<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>
|
|
|
+ <u-checkbox-group>
|
|
|
+ <u-checkbox active-color="#0076FF" 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>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import * as userApi from '@/apis/user.js'
|
|
|
+ import ucarkeyboard from '@/components/Ucarkeyboard.vue'
|
|
|
+
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ ucarkeyboard
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ keyShow: false,
|
|
|
+ form: {
|
|
|
+ carNum: '',
|
|
|
+ defaultFlag: true,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(op) {
|
|
|
+ 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') {
|
|
|
+ this.code = str2;
|
|
|
+ this.codeId = str3;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
-
|
|
|
+ checkboxChange() {
|
|
|
+ this.form.defaultFlag = !this.form.defaultFlag;
|
|
|
+ },
|
|
|
+ // 按键被点击(点击退格键不会触发此事件)
|
|
|
+ valChange(val) {
|
|
|
+ // 将每次按键的值拼接到form.carNum变量中,注意+=写法
|
|
|
+ this.form.carNum += val;
|
|
|
+ console.log(this.form.carNum);
|
|
|
+ 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);
|
|
|
+ console.log(this.form.carNum);
|
|
|
+ },
|
|
|
+ keepCar() {
|
|
|
+ uni.showLoading({
|
|
|
+ title: "加载中",
|
|
|
+ mask: true,
|
|
|
+ })
|
|
|
+ userApi.addRegUserCar(this.form).then((res) => {
|
|
|
+ uni.hideLoading();
|
|
|
+
|
|
|
+ if(this.code == 'A') {
|
|
|
+ uni.navigateBack({
|
|
|
+ url: '/pages/searchPile/stationAndPile/chargingPileDetails?id=' + this.codeId
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateBack({
|
|
|
+ url: '/pages/user/car/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ uni.showToast({
|
|
|
+ title: error,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -23,5 +94,17 @@
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="scss" scoped>
|
|
|
+ .slot-wrap{
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+ .carDet{
|
|
|
+ padding: 0 16px;
|
|
|
+ }
|
|
|
|
|
|
+ .login-btn {
|
|
|
+ margin: 28px ;
|
|
|
+ background-color:#00B962!important;
|
|
|
+ border-color: #00B962!important;
|
|
|
+ color:#fff!important;
|
|
|
+ }
|
|
|
</style>
|