aleyds 3 år sedan
förälder
incheckning
3f506dea7f
1 ändrade filer med 62 tillägg och 20 borttagningar
  1. 62 20
      pages/getout/getoutpage/getoutpage.vue

+ 62 - 20
pages/getout/getoutpage/getoutpage.vue

@@ -21,7 +21,7 @@
 			<view class="parking-info-item">进场时间:{{leaveDetail.inTime}}</view>
 			<view class="parking-info-item">出场时间:{{leaveDetail.outTime}}</view>
 			<view class="parking-info-item">停车时长:{{leaveDetail.duration}}</view>
-			<view class="parking-info-item">本次应收:<span class="u-type-primary">{{leaveDetail.totalAmount}}元</span></view>
+			<view class="parking-info-item">本次应收:<span class="u-type-primary">{{leaveDetail.payAmount}}元</span></view>
 			<view class="parking-info-item u-flex u-row-between"  @click="goOwelist">
 				<view class="">
 					历史欠费:<span class="u-type-warning">{{leaveDetail.oweAmount}}元</span>
@@ -37,7 +37,7 @@
 		</view>
 		
 		<!-- 订单细节 -->
-		<u-popup class="popup orderDetails" v-model="showOrderDetails" :mask-close-able="false" mode="center" border-radius="20" width="90%">
+		<u-popup class="popup orderDetails" v-model="detailModel.show" :mask-close-able="false" mode="center" border-radius="20" width="90%">
 			<view class="popup-title">温馨提示</view>
 			<view class="details-body">
 				<dl><dt>停车时长:</dt> <dd>{{leaveDetail.duration}}</dd></dl>
@@ -49,8 +49,11 @@
 				</view>
 			</view>
 			<view class="details-footer u-flex u-row-between">
-				<view class="details-footer-btn details-footer-btn--blue" @click="payAll">全部缴费</view>
+				<!-- <view  class="details-footer-btn details-footer-btn--blue"  @click="payAll">全部缴费</view>
 				<view class="details-footer-btn details-footer-btn--yellow" @click="payThis">本次缴费</view>
+				 -->
+				<u-button type="primary" :disabled="detailModel.payAllbtn" @click="payAll">全部缴费</u-button>
+				<u-button type="warning" :disabled="detailModel.payOnebtn" @click="payThis">本次缴费</u-button>
 				<view class="details-footer-btn bg-gray" @click="openPage('pages/getout/getout')">取消</view>
 			</view>
 		</u-popup>
@@ -140,8 +143,12 @@
 				},
 				showQrcode:false,
 				qrcontent:'',
-				timer: null // 定时器
-				
+				timer: null, // 定时器
+				detailModel:{
+					show: false,
+					payAllbtn: true,
+					payOnebtn: true
+				}
 				
 			}
 		},
@@ -152,9 +159,8 @@
 			this.orderSpaceName = page.orderSpaceName;
 			this.orderVehicleNo = page.orderVehicleNo;
 			// #ifdef APP-PLUS
-			// this.speaks(this.orderVehicleNo);
+			this.speaks(this.orderVehicleNo);
 			// #endif
-			// this.handleEntranceOutDetail();
 			
 		},
 		onShow() {
@@ -167,9 +173,9 @@
 					url: path
 				})
 			},
-			// speaks(msg){
-			// 	speak?.speakAction(msg)
-			// },
+			speaks(msg){
+				speak?.speakAction(msg)
+			},
 			handleEntranceOutDetail(){
 				this.$u.api.entranceOutDetail({spaceId:this.orderID})
 				.then(res=>{
@@ -183,22 +189,62 @@
 				
 			},
 			handleOut(res){
-				this.showOrderDetails = true;
+				let that = this;
+				// this.showOrderDetails = true;
+				this.$u.api.getOut({spaceId:this.orderID})
+				.then(res=>{
+					//1、当前订单金额和历史缴费金额都为0 --无需缴费--跳转
+					// ALog.info({msg: that.leaveDetail.oweAmount});
+					// ALog.info({msg:  res.data.payAmount});
+					debugger
+					if(that.leaveDetail.oweAmount == 0 && res.data.payAmount == 0){
+						that.$refs.uToast.show({
+							title: '金额为0无需支付',
+							type: 'success',
+							url:'pages/getout/getout'
+						});
+					}else if (that.leaveDetail.oweAmount == 0 && res.data.payAmount > 0){
+						that.detailModel.show = true;
+						that.detailModel.payAllbtn = false;
+						that.detailModel.payOnebtn = true;
+					}else if (that.leaveDetail.oweAmount > 0 && res.data.payAmount == 0){
+						that.detailModel.show = true;
+						that.detailModel.payOnebtn = false;
+						that.detailModel.payAllbtn = true;
+					}else {
+						that.detailModel.show = true;
+						that.detailModel.payOnebtn = true;
+						that.detailModel.payAllbtn = true;
+					}
+					//#ifdef APP-PLUS
+					that.speaks(res.data.speak);
+					device.print(res.data.print);
+					//#endif
+					console.log('getOut',res)
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+					console.log('getOut ',err)
+				});
 			},
 			async payThis(){
-				this.showOrderDetails = false;
+				// this.showOrderDetails = false;
+				this.detailModel.show = false;
 				this.showPayway = true;
 				this.payParams.orderList.push(this.leaveDetail.orderId);
-				await this.confirmOut();
+				// await this.confirmOut();
 			},
 			async payAll(){
-				this.showOrderDetails = false;
+				// this.showOrderDetails = false;
+				this.detailModel.show = false;
 				this.showPayway = true;
 				this.payParams.orderList.push(this.leaveDetail.orderId);
 				this.leaveDetail.oweList.forEach(item=>{
 					this.payParams.orderList.push(item.orderId);
 				});
-				await this.confirmOut();
+				// await this.confirmOut();
 			},
 			closePayway(){
 				this.showPayway = false;
@@ -283,11 +329,6 @@
 			confirmOut(){
 				this.$u.api.getOut({spaceId:this.orderID})
 				.then(res=>{
-					// this.$refs.uToast.show({
-					// 	title: res.msg,
-					// 	type: 'success',
-					// 	url:'pages/getout/getout'
-					// });
 					//#ifdef APP-PLUS
 					this.speaks(res.data.speak);
 					device.print(res.data.print);
@@ -340,6 +381,7 @@
 					}
 				});
 			},
+			
 			timeago(inTime,outTime){
 				var time_start = new Date(inTime.replace(/-/g,'/'));
 				var time_end = new Date(outTime.replace(/-/g,'/'));