| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533 | <template>	<view class="content">		<!-- 填写车辆信息 -->		<view class="carMessage">			<view class="mesView">				<view class="leftTitle">车牌号</view>				<input class="plateNumber" placeholder-style="color:#999999" placeholder="请输入车牌号" disabled="true"					@tap="plateShow=true" v-model.trim="plateNo" />				<plate-input v-if="plateShow" :plate="plateNo" @export="setPlate" @close="plateShow=false" />						</view>			<view class="line"></view>						<view class="mesView">				<view class="leftTitle">VIN</view>				<input class="vinInput selectColor" type="text" v-model="vin" placeholder="请输入"					placeholder-style="color:#999999" />				<view class="kmStr"></view>			</view>			<view class="line"></view>			<view class="mesView" @click="goCarModel()">				<view class="leftTitle">车型</view>				<view class="carModBtn noSelectColor" v-if="!carModelInfo.value">请选择车型</view>				<view class="carModBtn selectColor carMod" v-else>{{carModelInfo.value}}</view>				<image src="../../../static/img/big_rightArrow.png" class="big_rightArrow"></image>			</view>			<view class="line"></view>						<view class="mesView">				<view class="leftTitle">行驶里程</view>				<input class="mileageInput selectColor" type="number" v-model="mileage" placeholder="请输入"					placeholder-style="color:#999999" />				<view class="kmStr">km</view>			</view>			<view class="line"></view>						<view class="mesView">				<view class="leftTitle">注册登记时间</view>				<picker class="timeBtn" @change="bindChange" mode="date" :end="currentdate" :value="time">					<view class="uni-input selectColor" v-if="time">{{time}}</view>					<view class="uni-input noSelectColor" v-else>请选择</view>				</picker>				<image src="../../../static/img/big_rightArrow.png" class="big_rightArrow"></image>			</view>		</view>		<view class="bottomView">			<view class="saveCar" @click="saveCar()">保存</view>		</view>			</view></template><script>	import plateInput from "@/components/uni-plate-input/uni-plate-input.vue"	export default {		components: {			plateInput		},		data() {			return {				plateNo: '',				plateShow: false,				carModelInfo: '',				time: '',				mileage: '',				carId: '',				isEditCar: false,				currentdate: '',				plate_type: '',				sbPlate: [],				visible: false,				defaultProps: {					"label": "value",					"value": "ids"				},				vin: '',				type:'',			}		},		onLoad(opt) {			uni.removeStorageSync('carModelInfo');			this.getNowFormatDate();			console.log(opt);			this.type=opt.type			this.isEditCar = opt.isEditCar			this.carId = opt.id			if (this.isEditCar == 'true') {				this.getEditData()				uni.setNavigationBarTitle({					title: '编辑爱车'				})			}		},		onShow() {			var carModelInfo = uni.getStorageSync("carModelInfo");			if (carModelInfo) {				this.carModelInfo = carModelInfo;			}		},		methods: {			onConfirm(e) {				console.log(e)				this.carModelInfo = e.obj			},			onCancel() {				this.visible = false			},			getNowFormatDate() {				var date = new Date();				var seperator1 = "-";				var year = date.getFullYear();				var month = date.getMonth() + 1;				var day = date.getDate();				if (month >= 1 && month <= 9) {					month = "0" + month;				}				if (day >= 0 && day <= 9) {					day = "0" + day;				}				var currentdate = year + seperator1 + month + seperator1 + day;				this.currentdate = currentdate;			},			getEditData() {				uni.showLoading({					title: '加载中'				})				var carModelInfo = {					carModelInfo: {					}				}				this.$http('opencarInfoOwner/queryCarInfoDetail', {					id: this.carId				}, 'GET').then(res => {					uni.hideLoading();					carModelInfo.carModelInfo.logo = res.data.brandLogo;					carModelInfo.carModelInfo.brand = res.data.brand;					carModelInfo.carModelInfo.carSeries = res.data.series;					carModelInfo.carModelInfo.displacement = res.data.displacement;					carModelInfo.carModelInfo.transmissionType = res.data.transmissionType;					carModelInfo.carModelInfo.productionYear = res.data.annualmoney;					carModelInfo.carModelInfo.carModel = res.data.carModel;					carModelInfo.carModelInfo.guidePrice = res.data.guidePrice;					carModelInfo.carModelInfo.engineModel = res.data.engineType;					carModelInfo.carModelInfo.nLevelID = res.data.nLevelID;					carModelInfo.carModelInfo.salesName = res.data.saleName;					// 展示时					this.plateNo = res.data.plateNumber;					carModelInfo.value = res.data.carModel;					if (res.data.buyDate) {						this.time = res.data.buyDate.slice(0,10);					}					this.mileage = res.data.milage;					this.carModelInfo = carModelInfo;					this.vin = res.data.vIN					console.log('this carModelInfo', this.carModelInfo);				})			},			goCarModel() {				uni.navigateTo({					url: 'carModel'				})			},			setPlate(plate) {				console.log(plate)				if (plate.length >= 7) this.plateNo = plate;				this.plateShow = false;				if (plate.length == 7) {					this.plate_type = 2				} else {					this.plate_type = 52				}				// this.queryCarmodelByPlateNumber()			},			queryCarmodelByPlateNumber() {				uni.showLoading({					title: '加载中'				})				this.$http('worldKeepCar/worldHome/queryCarmodelByPlateNumber', {					license_plate: this.plateNo,					plate_type: this.plate_type,				}, 'GET').then(res => {					uni.hideLoading();					console.log(res);					if (res.data) {						this.vin = res.data.vin						if (res.data.buyTime) {							this.time = res.data.buyTime.slice(0, res.data.buyTime.length - 8);						}					}					if (res.data.list && res.data.list.length > 0) {						this.sbPlate = res.data.list						//this.sbPlate=this.sbPlate.concat(this.sbPlate)						if (this.sbPlate.length == 1) {							//this.carModelInfo.value=res.data[0].value							this.carModelInfo = res.data.list[0]						} else {							this.visible = true						}					}				})			},			bindChange(e) {				console.log(e);				this.time = e.target.value			},			saveCar() {				uni.showLoading({					title: '保存中'				})				if (this.plateNo == '') {					uni.showToast({						title: '请填写车牌号',						icon: 'none',						duration: 3000					});					return false;				}												if (this.isEditCar == 'true') {					this.updateTMemberCar()				} else {					this.addTMemberCar()				}			},			addTMemberCar() {				var cardata = {					plateNumber: this.plateNo,					milage: this.mileage?this.mileage:0,					brand: "",					displacement: "",					series: "",					annualmoney: "",					carModel: "",					saleName: "",					transmissionType: "",					model: "",					nLevelID: "",					engineType: "",					brandLogo: "",					buyDate: this.time,					guidePrice: "",					vIN: this.vin,				};				if(this.carModelInfo){					cardata = {						plateNumber: this.plateNo,						milage: this.mileage?this.mileage:0,						brand: this.carModelInfo.carModelInfo.brand,						displacement: this.carModelInfo.carModelInfo.displacement,						series: this.carModelInfo.carModelInfo.carSeries,						annualmoney: this.carModelInfo.carModelInfo.productionYear,						carModel: this.carModelInfo.value,						saleName: this.carModelInfo.carModelInfo.salesName,						transmissionType: this.carModelInfo.carModelInfo.transmissionType,						model: this.carModelInfo.carModelInfo.carModel,						nLevelID: this.carModelInfo.carModelInfo.nLevelID,						engineType: this.carModelInfo.carModelInfo.engineModel,						brandLogo: this.carModelInfo.carModelInfo.logo,						buyDate: this.time,						guidePrice: this.carModelInfo.carModelInfo.guidePrice,						vIN: this.vin,					}				}								this.$http('opencarInfoOwner/addCarOwner', cardata, 'POST').then(res => {					uni.hideLoading();					if (res.code == 0) {						uni.showToast({							title: '保存成功',							icon: 'none',							duration: 3000						});						uni.removeStorageSync('carModelInfo');						if(this.type==1){							uni.setStorage({								key: 'indexaddcar',								data: '1',								 success: function () {								    setTimeout(function() {								    	uni.navigateBack({								    								    	})								    }, 1000);								 								 }							}); 						}else{							setTimeout(function() {								uni.navigateBack({															})							}, 3000);						}											} else {						uni.showToast({							title: res.msg,							icon: 'none',							duration: 3000						});					}				})			},			updateTMemberCar() {				var cardata = {					plateNumber: this.plateNo,					milage: this.mileage,					brand: "",					displacement: "",					series: "",					annualmoney: "",					carModel: "",					saleName: "",					transmissionType: "",					model: "",					nLevelID: "",					engineType: "",					brandLogo: "",					buyDate: this.time,					guidePrice: "",					vIN: this.vin,					id:this.carId,				};				if(this.carModelInfo){					cardata = {						plateNumber: this.plateNo,						milage: this.mileage,						brand: this.carModelInfo.carModelInfo.brand,						displacement: this.carModelInfo.carModelInfo.displacement,						series: this.carModelInfo.carModelInfo.carSeries,						annualmoney: this.carModelInfo.carModelInfo.productionYear,						carModel: this.carModelInfo.value,						saleName: this.carModelInfo.carModelInfo.salesName,						transmissionType: this.carModelInfo.carModelInfo.transmissionType,						model: this.carModelInfo.carModelInfo.carModel,						nLevelID: this.carModelInfo.carModelInfo.nLevelID,						engineType: this.carModelInfo.carModelInfo.engineModel,						brandLogo: this.carModelInfo.carModelInfo.logo,						buyDate: this.time,						guidePrice: this.carModelInfo.carModelInfo.guidePrice,						vIN: this.vin,						id:this.carId,					}				}				this.$http('opencarInfoOwner/addCarOwner', cardata, 'POST').then(res => {					uni.hideLoading();					if (res.code == 0) {						uni.showToast({							title: '保存成功',							icon: 'none',							duration: 3000						});						uni.removeStorageSync('carModelInfo');						setTimeout(function() {							uni.navigateBack({							})						}, 3000);					} else {						uni.showToast({							title: res.msg,							icon: 'none',							duration: 3000						});					}				})			},		}	}</script><style>	.content {		min-height: 100vh;		background-color: #F4F5F7;		padding-top: 20rpx;	}	.carMessage {		margin: 0rpx 24rpx 40rpx;		padding-top: 20rpx;		height: 500rpx;		background-color: #FFFFFF;		border-radius: 10rpx;	}	.mesView {		display: flex;		align-items: center;		width: 100%;		height: 120rpx;		background-color: #FFFFFF;	}	.leftTitle {		margin: 28rpx;		width: 180rpx;		font-size: 28rpx;		color: #666666;	}	.noSelectColor {		color: #999999;	}	.selectColor {		color: #333333;	}	.carMod {		text-overflow: -o-ellipsis-lastline;		overflow: hidden;		text-overflow: ellipsis;		display: -webkit-box;		-webkit-line-clamp: 2;		line-clamp: 2;		-webkit-box-orient: vertical;	}	.big_rightArrow {		margin-right: 28rpx;		width: 14rpx;		height: 23rpx;	}	.cityBtn {		width: 65%;		font-size: 28rpx;	}	.plateNumber {		width: 55%;		font-size: 28rpx;	}	.carModBtn {		width: 65%;		font-size: 28rpx;	}	.timeBtn {		width: 65%;		font-size: 28rpx;	}	.mileageInput {		width: 20%;		font-size: 28rpx;	}	.vinInput{		width: 60%;		font-size: 28rpx;	}	.kmStr {		font-size: 28rpx;		color: #333333;	}	.bottomView {		background-color: #FFFFFF;		width: 100%;		height: 120rpx;		position: fixed;		bottom: 0rpx;		padding-bottom: constant(safe-area-inset-bottom);		padding-bottom: env(safe-area-inset-bottom);	}	.saveCar {		background-color: #D53533;		margin: 23rpx 30rpx;		height: 74rpx;		border-radius: 37rpx;		color: #FFFFFF;		font-size: 30rpx;		font-weight: bold;		text-align: center;		line-height: 74rpx;	}	.line{		margin: 1rpx 28rpx;		background-color: #EEEEEE;		height: 1rpx;	}</style>
 |