Pārlūkot izejas kodu

手机端增加停车场车位总数、空闲数编辑;停车记录增加手动出场功能

chenwen 1 gadu atpakaļ
vecāks
revīzija
7c8d205815

+ 9 - 0
apis/myparkings.js

@@ -32,3 +32,12 @@ export function manualPass(channelId,noteTxt){
 	})
 }
 
+
+export function updateParkingSeat(parkingId,totalCount,idleCount){
+	return request({
+		method: 'post',
+		data:{parkingId,totalCount,idleCount} ,
+		url: '/mobileApi/parkingSite/updateParkingSeat'
+	})
+}
+

+ 12 - 0
apis/parkinglog.js

@@ -16,3 +16,15 @@ export function loadPageData(param){
 export function getMyParkSites(){
 	return app.takeSetting("myParks");
 }
+
+
+
+export function manualOut(parkingLogId,callerId){
+	
+	return request({
+		method: 'post',
+		data:{parkingLogId,callerId},
+		url: '/mobileApi/parkingLog/manualOutParking'
+	})
+}
+

+ 66 - 4
pages/parking/parkingSiteDes.vue

@@ -4,9 +4,16 @@
 		</u-navbar>
 		<view class="parking-panel">
 			<view class="panel-left">
-				<text class="left-title">{{parkingSite.parking_name}}</text>
-				<text class="left-txt">总车位数 {{parkingSite.total_parking_number}}</text>
-				<view class="left-txt">普通车位数<text class="num-txt"></text> / <text class="newpower-txt">新能源车位<text class="num-txt"></text></text></view>
+				<view>
+					<text class="left-title">{{parkingSite.parking_name}}</text>
+					<u-icon name="edit-pen" size="32" color="#4a4a4a" style="margin-left:100rpx;padding:10rpx;" @tap="editParking"></u-icon>
+				</view>
+				
+				<view class="left-txt">
+					<text>总车位数 </text><text class="num-txt">{{parkingSite.total_parking_number}}</text>
+					
+				</view>
+				<view class="left-txt">剩余车位数<text class="num-txt">{{parkingSite.surplus_parking_number}}</text></view>
 			</view>
 			<image :src="parkingSite.pic_url" style="width:200rpx;height:160rpx;border-radius: 10rpx;"></image>
 		</view>
@@ -43,6 +50,13 @@
 					<u-field  v-model="passNote" label="" placeholder="请填写放行说明" type="textarea" label-width="0" :auto-height="false" :field-style="{height:'140rpx'}"/>
 			</view>
 		</u-modal>
+		
+		<u-modal v-model="showEditModal" ref="editModal" title="车位数编辑" :show-cancel-button="true" :async-close="true" @confirm="submitSeat">
+			<view class="slot-content">
+				<u-field type="number" v-model="seatModel.total" label="总车位数" :label-width="150" :field-style="{'border-bottom':'1px solid #55aaff'}"/>
+				<u-field type="number" v-model="seatModel.idle" label="剩余车位数" :label-width="150" :field-style="{'border-bottom':'1px solid #55aaff'}"/>
+			</view>
+		</u-modal>
 	</view>
 </template>
 
@@ -61,13 +75,61 @@
 				parkingSite:{},
 				chargeRule:{},
 				othChargeRule:[],
-				devs:[]
+				devs:[],
+				showEditModal:false,
+				seatModel:{
+					total:null,
+					idle:null
+				}
 			}
 		},
 		onLoad(opt){
 			this.loadPageData(opt.park_id);
 		},
 		methods: {
+			editParking(){
+				this.showEditModal=true;
+				this.seatModel.total=this.parkingSite.total_parking_number;
+				this.seatModel.idle=this.parkingSite.surplus_parking_number;
+			},
+			closeEditModal(isClose){
+				if(isClose){
+					this.showEditModal=false;
+				}
+				else{
+					this.$refs.editModal.clearLoading();
+				}
+			},
+			submitSeat(){
+				
+				api.updateParkingSeat(this.parkingSite.id,this.seatModel.total,this.seatModel.idle).then(resp=>{
+					if(!resp.success){
+						uni.showToast({
+							title:resp.msg||'保存数据失败',
+							icon:'none'
+						})
+						this.closeEditModal()
+						return;
+					}
+					
+					uni.showToast({
+						title:'操作成功',
+						icon:'success'
+					})
+					this.closeEditModal(true)
+					
+					//编辑后的值设置到显示对象中,不用请求后台
+					this.parkingSite.total_parking_number=this.seatModel.total;
+					this.parkingSite.surplus_parking_number=this.seatModel.idle;
+					
+				}).catch(err=>{
+					uni.showToast({
+						title:'保存数据出错',
+						icon:'none'
+					})
+					this.closeEditModal()
+				})
+			},
 			manualPass(channelId,channelName){
 				if(this.opening){
 					uni.showToast({

+ 46 - 2
pages/parking/parkinglog.vue

@@ -43,7 +43,7 @@
 		<u-tabs :list="tablist" :is-scroll="false" :current="currentTab" @change="changeTab"></u-tabs>
 		<scroll-view style="padding:20rpx;height:calc(100vh - 135px)" scroll-y="true"  @scrolltolower="scrollbtm">
 			
-			<view class="tab-con-item"  v-for="(item,index) in pagedData.records" :key="item.id">
+			<view class="tab-con-item"  v-for="(item,index) in pagedData.records" :key="index">
 				<view class="item-top">
 					<u-image width="200rpx" height="160rpx" :src="item.car_img" border-radius="5rpx" @click="previewCarPhoto(item.car_img)"></u-image>
 					<view class="item-top-right">
@@ -57,7 +57,7 @@
 				</view>
 				<view class="item-footer">
 					<text class="car-num">{{item.car_num}}</text>
-					<!-- <view class="item-footer-btn" v-if="item.release_status=='0'" @tap="chargingAndPass(item.id)">收费离场</view> -->
+					<view class="item-footer-btn" v-if="item.release_status=='0'" @tap="manualOut(item)">手动出场</view>
 				</view>
 			</view>
 			
@@ -74,6 +74,7 @@
 
 <script>
 	import * as api from '@/apis/parkinglog.js'
+	import app from '@/utils/app.js'
 	
 	export default {
 		data() {
@@ -235,6 +236,49 @@
 					urls: array,
 					current: array[0]
 				});
+			},
+			manualOut(record){
+				let con=`确定要对车辆【${record.car_num}](停车${record.parking_time_txt})进行手动出场吗?`;
+				uni.showModal({
+					title:'手动出场确认',
+					content:con,
+					success:(res)=>{
+						if (res.confirm) {
+							this.manualOutSubmit(record.id)		
+						} else if (res.cancel) {
+							console.log('用户取消手动出场');
+						}
+					}
+				})
+			},
+			manualOutSubmit(recordId){
+				api.manualOut(recordId,app.takeSetting('user_id')).then(resp=>{
+					if(!resp.success){
+						uni.showToast({
+							title:resp.msg||'手动出场失败',
+							icon:'none'
+						})
+						return;
+					}
+					
+					uni.showToast({
+						title:'操作成功',
+						icon:'success'
+					})
+					
+					//避免成功提示跳过
+					setTimeout(()=>{
+						this.loadPageData(this.getLoadParams(this.pagedData.pageNum));
+					},1500)
+					
+					
+					
+				}).catch(err=>{
+					uni.showToast({
+						title:'手动出场出错',
+						icon:'none'
+					})
+				})
 			}
 		}
 	}