| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 | <template>	<view class="">		<view class="car-info u-flex">			<view class="car-info-img">				<u-image :src="leaveDetail.vehicleImage||vehicleImage" mode="aspectFit" width="100%" height="100%"></u-image>			</view>			<view class="car-info-text u-flex-1">				<view class="text-item">					<view class="car">{{ leaveDetail.vehicleNo }}</view>					<view class="position">车位:{{leaveDetail.spaceName}}</view>				</view>				<!-- <view class="text-item" style="color: #3192FB;">临时卡</view> -->				<!-- <view class="text-item u-flex u-flex u-row-between">					<view class="">余额:<span class="balance">暂无</span></view>					<view class="recharge" @click="$refs.uToast.show({title: '建设中'})">充值</view>				</view> -->				<view class="text-item">类型:{{leaveDetail.vehicleType|filterCarType}}</view>			</view>		</view>		<view class="parking-info">			<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.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>				</view>				<u-icon name="arrow-right" color="#7B7B7B" size="28"></u-icon>			</view>		</view>		<view class="bottom-btn-wrap">			<view class="bottom-btn-box u-flex">				<view class="bottom-btn bg-blue" @click="handleOut">出场</view>				<view class="bottom-btn bg-gray" @click="onCancel()">取消</view>			</view>		</view>				<!-- 订单细节 -->		<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>				<dl><dt>车辆类型:</dt> <dd>{{leaveDetail.vehicleType|filterCarType}}</dd></dl>				<dl><dt>本次应收:</dt> <dd class="u-type-primary">{{leaveDetail.payAmount}}元</dd></dl>				<dl><dt>历史欠费:</dt> <dd class="u-type-warning">{{leaveDetail.oweAmount}}元</dd></dl>				<view class="tip">					你是否将该车辆出场,如果是请缴费,否则点击取消!				</view>			</view>			<view class="details-footer u-flex u-row-between">				<u-button type="primary" :disabled="detailModel.payAllbtn" @click="onPayAll">全部缴费</u-button>				<u-button type="warning" :disabled="detailModel.payOnebtn" @click="onPayThis">本次缴费</u-button>				<view class="details-footer-btn bg-gray" @click="onPayCancel">取消</view>			</view>		</u-popup>		<!-- 支付方式 -->		<u-popup class="popup payway-popup" v-model="showPayway" :mask-close-able="false" mode="center" border-radius="20" width="90%">			<view class="popup-title">支付方式</view>			<view class="popup-body u-flex u-row-between">				<view class="payway-item"  @click="$refs.uToast.show({title: '暂不支持'})">					<u-image src="/static/img/payway-xj.png" width="143" height="143"></u-image>					<!-- <view class="icon-wrap">						<u-icon name="rmb-circle-fill" color="#FFC02D" size="66"></u-icon>					</view> -->					现金支付				</view>				<view class="payway-item" @click="scanPay()">					<u-image src="/static/img/payway-scan.png" width="143" height="143"></u-image>					<!-- <view class="icon-wrap">						<u-icon name="scan" color="#FFC02D" size="66"></u-icon>					</view> -->					扫码收费				</view>				<view class="payway-item" @click="qrPay">					<u-image src="/static/img/payway-qr.png" width="143" height="143"></u-image>					<!-- <view class="icon-wrap">						<u-icon name="rmb-circle-fill" color="#FFC02D" size="66"></u-icon>					</view> -->					收款码				</view>			</view>			<view class="popup-footer payway-popup-footer">				<view class="payway-popup-btn" @click="closePayway">关闭</view>			</view>		</u-popup>		<u-popup class="popup qrcode-popup" v-model="showQrcode" :mask-close-able="false" mode="center" border-radius="20" width="90%">			<tki-qrcode			    ref="qrcode"			    cid="tki-qrcode-canvas"			    :val="qrcontent"			    :size="200"			    unit="px"			    background="#000000"			    foreground="#ffffff"			    pdground="#ffffff"			    :iconSize="40"			    :onval="true"			    :loadMake="false"			    :usingComponents="true"			    :showLoading="false"			    loadingText="loadingText"			     />			<view class="qrcode-popup-btn" @click="hideQrcode">关闭</view>		</u-popup>		<u-toast ref="uToast" />	</view></template><script>	//#ifdef APP-PLUS	let speak = uni.requireNativePlugin("SpeechPlug");	let device = uni.requireNativePlugin("DeviceInfo");	let ALog = uni.requireNativePlugin("AndroidLog")	//#endif	import tkiQrcode from "tki-qrcode";	export default {		components:{			tkiQrcode		},		data() {			return {				vehicleImage:'/static/img/default-car.png',				showOrderDetails:false,//是否线上订单细节				leaveDetail:[],				orderID:'',				orderInTime:'',				orderOutTime:'',				orderSpaceName:'',				orderVehicleNo:'',				totalAmount:'',				oweAmount:'',				duration:'',				vehicleType:0,				payStatus:null,				showPayway:false,				payParams:{					orderList:[],					code:''				},				showQrcode:false,				qrcontent:'',				timer: null, // 定时器				detailModel:{					show: false,					payAllbtn: false,					payOnebtn: false				}							}		},		onLoad(page) {			this.orderID = page.orderID;			this.orderInTime = page.orderInTime;			this.orderOutTime = page.orderOutTime;			this.orderSpaceName = page.orderSpaceName;			this.orderVehicleNo = page.orderVehicleNo;			// #ifdef APP-PLUS			// this.speaks(this.orderVehicleNo);			// #endif					},		onShow() {			this.handleEntranceOutDetail();		},		methods:{			onCancel(){				// this.$u.route({				// 	type: 'redirectTo',				// 	url: 'pages/getout/getout'				// })				uni.navigateBack({				    delta: 1				});			},			onPayCancel(){				// this.$u.route({				// 	type: 'redirectTo',				// 	url: '/pages/getout/getout'				// })				uni.navigateBack({				    delta: 1				});			},			speaks(msg){				speak?.speakAction(msg)			},			handleEntranceOutDetail(){				this.$u.api.entranceOutDetail({spaceId:this.orderID})				.then(res=>{					this.leaveDetail = res.data;				}).catch(err=>{					this.$refs.uToast.show({						title: err.msg,						type: 'error',					});				});							},			handleOut(res){				let that = this;				this.$u.api.getOut({spaceId:this.orderID})				.then(res=>{					//1、当前订单金额和历史缴费金额都为0 --无需缴费--跳转					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 = true;						that.detailModel.payOnebtn = false;					}else if (that.leaveDetail.oweAmount > 0 && res.data.payAmount == 0){						that.detailModel.show = true;						that.detailModel.payOnebtn = true;						that.detailModel.payAllbtn = false;					}else {						that.detailModel.show = true;						that.detailModel.payOnebtn = false;						that.detailModel.payAllbtn = false;					}					//#ifdef APP-PLUS					that.speaks(res.data.speak);					device.print(res.data.print);					//#endif				}).catch(err=>{					this.$refs.uToast.show({						title: err.msg,						type: 'error',					});					console.log('getOut ',err)				});			},			async onPayThis(){				this.detailModel.show = false;				this.showPayway = true;				this.payParams.orderList.push(this.leaveDetail.orderId);				// await this.confirmOut();			},			async onPayAll(){				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();			},			closePayway(){				this.showPayway = false;			},			scanPay(){				uni.scanCode({				    onlyFromCamera: true,					scanType:['barCode','qrCode'],				    success:  (res) => {						this.payParams.code = res.result;						this.$u.api.gzbankSwept(this.payParams)						.then(res=>{							// 启动定时器查询订单状态							uni.showLoading({								 title: '查询支付状态中'							});							this.timer = setInterval(() => {							  this.handlePayQuery(res.data.polyOrderId)							}, 3000);						}).catch(err=>{							//#ifdef APP-PLUS							plus.nativeUI.toast(err.msg);							//#endif						});										    },					fail:function(err){						//#ifdef APP-PLUS						plus.nativeUI.toast('扫码失败');						ALog.info({msg:'条码类型:err' + err});						//#endif					}				});							},			qrPay(){				console.log('this.payParams',this.payParams);				this.$u.api.gzbankPolypay(this.payParams)				.then(res=>{					// this.$refs.uToast.show({					// 	title: res.msg,					// 	type: 'success',					// });					this.showPayway = false;					this.showQrcode = true;					setTimeout(()=>{						this.qrcontent = res.data.qrCodeUrl;					},500)										// 启动定时器查询订单状态					uni.showLoading({						 title: '等待支付中'					});					this.timer = setInterval(() => {					  this.handlePayQuery(res.data.polyOrderId)					}, 3000);					console.log('gzbankPolypay',res)				}).catch(err=>{					this.$refs.uToast.show({						title: err.msg,						type: 'error',					});					console.log('gzbankPolypay ',err)				});							},			hideQrcode(){				this.showQrcode = false;				this.$u.route({					url: 'pages/getout/getout',				});			},			confirmOut(){				this.$u.api.getOut({spaceId:this.orderID})				.then(res=>{					//#ifdef APP-PLUS					this.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)				});			},			handlePayQuery(polyOrderId){				this.$u.api.payQuery({polyOrderId:polyOrderId})				.then(res=>{					// this.$refs.uToast.show({					// 	title: res.msg,					// 	type: 'success',					// });					// 支付成功后的页面跳转					if (res.data.payStatus==1) {						uni.hideLoading();					  clearInterval(this.timer)					  this.$refs.uToast.show({					  	title:'支付成功',					  	type: 'success',					  	url:'pages/getout/getout',						// params: {						// 	vehicleNo:this.orderVehicleNo,						// },						duration:10000					  });					};					console.log('handlePayQuery',res)				}).catch(err=>{					this.$refs.uToast.show({						title: err.msg,						type: 'error',					});					console.log('handlePayQuery ',err)				});							},			goOwelist(){				this.$u.route({					url: 'pages/owelist/owelist',					params: {						orderID: this.orderID					}				});			},						timeago(inTime,outTime){				var time_start = new Date(inTime.replace(/-/g,'/'));				var time_end = new Date(outTime.replace(/-/g,'/'));				var clock_start = time_start.getTime();				var clock_end = time_end.getTime();				// console.log('currentTime',this.currentTime)								const formatNumber = (num) => {					num = num.toString()					return num[1] ? num : '0' + num				};								var i_total_secs = Math.round(clock_end - clock_start);				//计算出相差天数				var days = Math.floor(i_total_secs / (24 * 3600 * 1000))					 				//计算出小时数				var leave1 = i_total_secs % (24 * 3600 * 1000)    //计算天数后剩余的毫秒数				var hours = Math.floor(i_total_secs / (3600 * 1000))								//计算相差分钟数				var leave2 = i_total_secs % (3600 * 1000)        //计算小时数后剩余的毫秒数				var minutes = Math.floor(leave2 / (60 * 1000))				//计算相差秒数				var leave3 = leave2 % (60 * 1000)      //计算分钟数后剩余的毫秒数				var seconds = Math.round(leave3 / 1000)								hours = formatNumber(hours);				minutes = formatNumber(minutes);				seconds = formatNumber(seconds);				// console.log(days + '天' + hours + '个小时' + minutes + '分钟' + seconds + '秒');				// this.frontDuration = hours + ':' + minutes + ':' + seconds;				return hours + ':' + minutes + ':' + seconds			}					},		computed:{			frontDuration:function(){				return this.timeago(this.orderInTime,this.orderOutTime)			}		}			}</script><style lang="scss">	@import "./getoutpage.scss";</style>
 |