oil-station/gasStation-uni/pagesMy/licensePlate/addCar.vue

206 lines
3.7 KiB
Vue
Raw Normal View History

2024-09-24 10:29:39 +08:00
<template>
<view class="content">
<view class="container">
<view class="box-left">请输入车牌号</view>
2024-09-26 13:45:57 +08:00
<view class="box-hang">
<input type="text" @click="upShow(1)" v-model="value" placeholder="鲁" class="box-input" />
<input type="text" @click="upShow(2)" v-model="value1" placeholder="A" class="box-input" />
<input type="text" @click="upShow(3)" v-model="value2" placeholder="请输入车牌号" class="box-car" />
2024-09-24 10:29:39 +08:00
</view>
2024-09-26 13:45:57 +08:00
<view class="but-sub" @click="submitCar()">保存</view>
2024-09-24 10:29:39 +08:00
<u-keyboard ref="uKeyboard" mode="car" @change="valChange" @backspace="backspace" :show="show"
2024-09-26 13:45:57 +08:00
@confirm="confirm1" @cancel="cancel1" :overlay="false"></u-keyboard>
2024-09-24 10:29:39 +08:00
</view>
</view>
</template>
<script>
import request from '../../utils/request';
export default {
data() {
return {
title: '',
List: [],
2024-09-26 13:45:57 +08:00
showIndex: 1,
2024-09-24 10:29:39 +08:00
pageNo: 1,
pageSize: 10,
totalPage: '',
value: '',
2024-09-26 13:45:57 +08:00
value1: '',
value2: '',
2024-09-24 10:29:39 +08:00
show: false,
2024-09-26 13:45:57 +08:00
show1: false,
show2: false,
2024-09-24 10:29:39 +08:00
}
},
onLoad() {},
onPullDownRefresh() {
//下拉刷新
uni.stopPullDownRefresh()
},
onReachBottom() {
// 触底加载
if (this.pageNo >= this.totalPage) {} else {
this.pageNo++
}
},
components: {
2024-09-26 13:45:57 +08:00
},
watch() {
2024-09-24 10:29:39 +08:00
},
methods: {
2024-09-26 13:45:57 +08:00
// 提交车牌号信息
submitCar() {
let carNo = this.value + this.value1 + this.value2
let storeId = uni.getStorageSync("storeId")
request({
url: '/business/userManager/userCarNo',
method: 'post',
data: {
storeId: storeId,
carNo: carNo
},
}).then(res => {
if (res.code == 200) {
uni.navigateBack()
}
})
},
upShow(num) {
this.showIndex = num
this.show = true
},
2024-09-24 10:29:39 +08:00
// 按键被点击(点击退格键不会触发此事件)
valChange(val) {
// 将每次按键的值拼接到value变量中注意+=写法
2024-09-26 13:45:57 +08:00
this.ifChange(val)
2024-09-24 10:29:39 +08:00
},
2024-09-26 13:45:57 +08:00
ifChange(val) {
if (this.showIndex == 1) {
this.value = val;
}
if (this.showIndex == 2) {
this.value1 = val;
}
if (this.showIndex == 3) {
this.value2 += val;
}
},
2024-09-24 10:29:39 +08:00
// 退格键被点击
backspace() {
// 删除value的最后一个字符
if (this.value.length) this.value = this.value.substr(0, this.value.length - 1);
console.log(this.value);
},
cancel1() {
this.show = false
},
confirm1() {
this.show = false
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 2px;
}
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
z-index: 99999;
.my-icons {
width: 20px;
}
position: fixed;
top: 0px;
}
.but-sub {
width: 305px;
height: 40px;
line-height: 40px;
margin: 0 auto;
background-color: #FF9655;
color: white;
border-radius: 50px;
text-align: center;
margin-top: 65px;
}
.box-hang {
width: 99%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 15px;
border-bottom: 1px solid #f4f5f6;
margin: 0 auto;
}
.box-left {
font-size: 16px;
font-weight: bold;
margin: 10px 0;
box-sizing: border-box;
padding: 0 15px;
}
.dis {
font-size: 14px;
color: #FA6400;
}
.box-input {
background: #ffffff;
width: 40px;
height: 50px;
text-align: center;
border-radius: 5px;
}
.box-car {
background: #ffffff;
width: 255px;
height: 50px;
border-radius: 5px;
box-sizing: border-box;
padding: 0 10px;
}
</style>