Browse Source

1.首页保存公里数

guo 3 years ago
parent
commit
fbb50fab6d
2 changed files with 21 additions and 4 deletions
  1. 7 3
      pages/index/addCar.vue
  2. 14 1
      pages/index/index.vue

+ 7 - 3
pages/index/addCar.vue

@@ -82,10 +82,11 @@
 			this.isEditCar = opt.isEditCar
 			this.carId = opt.id
 			if (this.isEditCar == 'true') {
+				
+				this.getEditData()
 				uni.setNavigationBarTitle({
 					title:'编辑爱车'
 				})
-				this.getEditData()
 			}
 		},
 		onShow() {
@@ -137,11 +138,14 @@
 					// 展示时
 					this.plateNo = res.data.plateNumber;
 					carModelInfo.title = res.data.carModel;
-					this.time = res.data.acarTime.slice(0,res.data.createTime.length-8);
+					if (res.data.acarTime) {
+						this.time = res.data.acarTime.slice(0,res.data.createTime.length-8);
+					}
 					this.mileage = res.data.milage;
 
 					this.carModelInfo = carModelInfo;
-
+					
+					console.log('this carModelInfo',this.carModelInfo);
 				})
 			},
 			goCarModel() {

+ 14 - 1
pages/index/index.vue

@@ -58,7 +58,7 @@
 			<view class="mesView">
 				<view class="leftTitle">行驶里程</view>
 				<input class="mileageInput selectColor" type="number" v-model="mileage" placeholder="请输入"
-					placeholder-style="color:#999999" />
+					placeholder-style="color:#999999" @confirm="upMileage" />
 				<view class="kmStr">km</view>
 			</view>
 
@@ -141,6 +141,19 @@
 		},
 
 		methods: {
+			upMileage(){
+				
+					this.$http('worldKeepCar/worldHome/updateTMemberCarByHome', {
+						id: this.memberCar.id,
+						milage: this.mileage?this.mileage:0,
+						
+					}, 'POST').then(res => {
+						uni.hideLoading();
+						console.log(res);
+					
+					})
+				
+			},
 			getLocation() {
 			
 				const that = this