123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <template>
- <view>
- <ujp-navbar :title="id!=0?'编辑':'新增'">
-
- <view slot="right" @click="infodelete()"
- v-if="id!=0"
- style="margin-right: 20px;">
- <span class="delete" >删除</span>
- </view>
- </ujp-navbar>
- <u-keyboard ref="uKeyboard"
- @change="valChange" @backspace="backspace"
- mode="car" v-model="show"></u-keyboard>
- <view class="ower-infos">
-
- <view class="infos-item border-none">
- <view class="title">
- 车牌号码<text class="asterisk">*</text>
- </view>
- <view class="content" @click="show=true">
-
- {{obj.carNum?obj.carNum:'请填写车牌号码'}}
-
- </view>
-
- </view>
- <view class="infos-item">
- <view class="title">
- 车辆品牌
- </view>
- <view class="content">
-
- <u-input v-model="obj.brand" placeholder="请填写车辆品牌" />
-
- </view>
-
- </view>
- <view class="infos-item">
- <view class="title">
- 限乘人数
- </view>
- <view class="content">
-
- <u-input type="number" v-model="obj.capacity" placeholder="请填写限乘人数" />
- </view>
-
- </view>
-
-
- </view>
-
- <u-button type="primary" @click="submit()">保存</u-button>
- </view>
- </template>
- <script>
- import * as API from '@/apis/accountType8.js'
- import {
- checkPhone
- } from '@/utils'
- export default {
- data() {
- return {
- show:false,
- value:'',
- uuid:'',
- id:"",
- entAccountId:"",
- obj:{
- carNum:"",
- entAccountId:0,
-
-
- brand:"",
- capacity:"",
-
- carId:"",
- }
- }
- },
- onReady() {
-
- if(this.id!=0){
-
- this.getInfo()
- }
-
-
- },
- onLoad(op) {
- this.entAccountId=op.p
- this.id=op.id
- this.uuid=op.uuid;
-
- },
- methods: {
- // 按键被点击(点击退格键不会触发此事件)
- valChange(val) {
- // 将每次按键的值拼接到value变量中,注意+=写法
- this.value += val;
- console.log(this.value);
- this.obj.carNum=this.value
- },
- // 退格键被点击
- backspace() {
- // 删除value的最后一个字符
- if(this.value.length) this.value = this.value.substr(0, this.value.length - 1);
- console.log(this.value);
- this.obj.carNum=this.value
- },
-
- infodelete(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- this.obj.entAccountId=this.entAccountId
- API.entCarDelete(this.obj).then((res) => {
- uni.hideLoading()
- this.carhelp.set("addOwnerInformation",{
- uuid:this.uuid,
- selectObj:this.obj
- })
- uni.showModal({
- showCancel:false,
- title: '提示',
- content: '操作成功',
- success: function (res) {
-
- uni.navigateBack({
-
- })
- }
- });
-
- }).catch(error => {
- uni.showToast({
-
- title: error
- })
- })
- },
- submit(){
-
-
- if(!this.obj.carNum){
- uni.showToast({
- title: "请填写车牌号码"
- })
- return false
- }
-
-
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- this.obj.entAccountId=this.entAccountId
- API.entCarSave(this.obj).then((res) => {
- uni.hideLoading()
- this.carhelp.set("addOwnerInformation",{
- uuid:this.uuid,
- selectObj:this.obj
- })
- uni.showModal({
- showCancel:false,
- title: '提示',
- content: '操作成功',
- success: function (res) {
-
- uni.navigateBack({
-
- })
- }
- });
-
- }).catch(error => {
- uni.showToast({
-
- title: error
- })
- })
- },
- getInfo(){
-
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.entCarDetails({
- entCarId:this.id,
-
- }).then((res) => {
-
- this.obj=res.data.entRegCar;
- this.obj.carId=this.id
-
- uni.hideLoading()
-
- }).catch(error => {
- uni.showToast({
-
- title: error
- })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- background-color: #f3f4f7;
- }
- .ower-infos{
- background-color: #fff;
- padding-left: 16px;
- .border-none{
- border: none !important;
- }
- .infos-item{
- padding: 24rpx 0;
- display: flex;
- border-bottom: 1px solid #e9e9e9 ;
- .title{
- width: 30%;
- font-size: 32rpx;
- line-height: 64rpx;
- color: #7d7d7d;
- .asterisk{
- color: #EE3138;
- }
- }
- .content{
- color: rgba(172, 172, 172, 100);
- font-size: 32rpx;
- line-height: 64rpx;
-
- }
- }
- }
- .u-btn{
- background-color: rgba(0, 90, 217, 100);
- margin: 16px;
- height: 44px;
- line-height: 44px;
- font-size: 18px
- }
- .delete{
- color: rgba(238, 49, 56, 100);
- font-size: 16px;
- }
- </style>
|