zaijin il y a 3 ans
Parent
commit
e8e7c142e4

+ 10 - 7
common/http.interceptor.js

@@ -49,14 +49,17 @@ const install = (Vue, vm) => {
 			// 如果把originalData设置为了true,这里return回什么,this.$u.post的then回调中就会得到什么
 			return res;  
 		} else if(res.msg == "令牌不能为空"||res.code == 401){
-			console.log('location',location)
-			console.log('location',location.href);
-			// storage.setItem('backUrl', location.href);
 			localStorage.setItem('backUrl', location.href)
-			alert('还未登录,即将跳转登录');
-			uni.navigateTo({
-				url: "/pages/center/phoneLogin/phoneLogin"
-			})
+			const loginUrl = 'phoneLogin'
+			console.log(loginUrl.indexOf(location.href))
+			if (loginUrl.indexOf(location.href) > 0) {
+				console.log(loginUrl.indexOf(location.href))
+			} else {
+				alert('还未登录,即将跳转登录');
+				uni.navigateTo({
+					url: "/pages/center/phoneLogin/phoneLogin"
+				})
+			}
 			
 		}else return res;
 	}

+ 3 - 1
pages.json

@@ -28,7 +28,9 @@
 		{
 			"path": "pages/center/order/order",
 			"style": {
-				"navigationBarTitleText": "停车列表"
+				"navigationBarTitleText": "停车记录",
+				"navigationBarBackgroundColor": "#008CFF",
+				"navigationBarTextStyle": "white"
 			}
 		},
 		{

+ 1 - 1
pages/center/order/order.vue

@@ -160,7 +160,7 @@ export default {
 			} else if(value === 1){
 				return '未出场';				
 			} else if(value === 2){
-				return '缴费中';				
+				return '出场未缴';				
 			} else if(value === 4){
 				return '已完成';				
 			} else {

+ 1 - 1
pages/chargeStandard/chargeStandard.scss

@@ -75,7 +75,7 @@
 		flex-direction: row;
 		justify-content: space-between;
 		padding: 25rpx 0;
-		border-bottom: solid 2rpx #979797;
+		border-bottom: solid 2rpx #EAEAEA;
 		view:first-child {
 			color: #2A2A2A;
 			font-weight: 400;

+ 2 - 1
pages/chargeStandard/chargeStandard.vue

@@ -24,7 +24,8 @@
 					</view>
 					<view class="charge-time">
 						<view>免费时长<text>{{item.freeTime}}分钟内</text></view>
-						<view>封顶金额<text>{{item.topAmt}}元</text></view>
+						<view v-if="item.topAmt">封顶金额<text>{{item.topAmt}}元</text></view>
+						<view v-else>无封顶金额</view>
 					</view>
 				</view>
 				<view class="charge-rules" v-for="(type, tIndex) in item.list" :key="tIndex">

+ 8 - 7
pages/handleMonthly/handleMonthly.vue

@@ -189,13 +189,14 @@
 							}).then(res => {
 								console.log("monthPay",res)
 								if(res.code === 200){
-									this.payUrl=encodeURIComponent(res.data.url);
-									this.$u.route({
-										url: 'pages/handleMonthly/monthPay',
-										params: {
-											payUrl:this.payUrl
-										}
-									});
+									// this.payUrl=encodeURIComponent(res.data.url);
+									// this.$u.route({
+									// 	url: 'pages/handleMonthly/monthPay',
+									// 	params: {
+									// 		payUrl:this.payUrl
+									// 	}
+									// });
+									window.location.href = res.data.url
 								} else {
 									this.$refs.uToast.show({
 										title: res.msg,

+ 1 - 1
pages/myCars/myCars.scss

@@ -104,7 +104,7 @@
 .mycars-item-tool .default{
 	display: inline-block;
 	box-sizing: border-box;
-	width: 75rpx;
+	// width: 75rpx;
 	height:38rpx;
 	line-height: 34rpx;
 	border-radius: 5rpx;

+ 2 - 1
pages/myCars/myCars.vue

@@ -29,7 +29,8 @@
 					<view class="mycars-item-sign" v-if="item.contractStatus==1">已签约</view>
 					<view class="mycars-item-sign1" v-if="item.contractStatus==0">未签约</view>
 					<view class="mycars-item-tool">
-						<span class="default" :class="{'isDefault':item.isDefault == 1}" @click="handlesetDefault(item.id)">默认</span>
+						<span class="default" v-if="item.isDefault == 1" :class="{'isDefault':item.isDefault == 1}" @click="handlesetDefault(item.id)">默认</span>
+						<span class="default" v-else @click="handlesetDefault(item.id)">设为默认</span>
 						<span @click="handleDelCar(item.id,item.vehicleNo)">删除</span>
 					</view>
 				</view>

+ 52 - 10
pages/parkingLists/parkingLists.vue

@@ -102,6 +102,7 @@
 				</view>
 			</view>
 		</view>
+		<u-select v-model="mapSelect" :list="mapSelectList" @confirm="mapSelectConfirm"></u-select>
 		<u-toast ref="uToast" />
 	</view>
 </template>
@@ -134,7 +135,24 @@
 				// 显示单个停车场数据
 				isShowParkingDetail: false,
 				// 单个停车场数据
-				parkingDetailData: {}
+				parkingDetailData: {},
+				mapSelect: false,
+				mapSelectList: [
+					{
+						value: '1',
+						label: '腾讯地图'
+					},
+					// {
+					// 	value: '2',
+					// 	label: '百度地图'
+					// },
+					{
+						value: '3',
+						label: '高德地图'
+					}
+				],
+				// 选中位置经纬度
+				currentPositionHover: {}
 			}
 		},
 		onLoad(page){
@@ -188,16 +206,40 @@
 			/**
 			  * 导航 
 			  * */
-			navigation (lat, lon) {
-				// uni.openLocation({
-				// 	latitude: parseFloat(lat),
-				// 	longitude: parseFloat(lon),
-				// 	scale: 18
-				// })
+			navigation (latitude, longitude) {
+				this.currentPositionHover = {
+					latitude: latitude,
+					longitude: longitude
+				}
+				this.mapSelect = true
 				// 腾讯地图用webview
-				uni.navigateTo({
-				  url: '/pages/parkingLists/map_web_view/map_web_view?url=https://3gimg.qq.com/lightmap/v1/marker/?marker=coord:'+lat+','+lon+'&referer=myApp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL'
-				})
+				// uni.navigateTo({
+				//   url: '/pages/parkingLists/map_web_view/map_web_view?url=https://3gimg.qq.com/lightmap/v1/marker/?marker=coord:'+latitude+','+longitude+'&referer=myApp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL'
+				// })
+			},
+			// 多地图选择
+			mapSelectConfirm(item) {
+				const name = item[0].label
+				console.log(this.currentPosition)
+				console.log(this.currentPositionHover)
+				switch(name) {
+					case '腾讯地图':
+						uni.navigateTo({
+						  url: '/pages/parkingLists/map_web_view/map_web_view?url=https://3gimg.qq.com/lightmap/v1/marker/?marker=coord:'+this.currentPositionHover.latitude+','+this.currentPositionHover.longitude+'&referer=myApp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL'
+						})
+						break;
+					case '百度地图':
+						uni.navigateTo({
+						  url: `/pages/parkingLists/map_web_view/map_web_view?url=${encodeURIComponent(`http://api.map.baidu.com/direction?origin=latlng:${this.latitude},${this.longitude}|name:起点&destination=latlng:${this.currentPositionHover.latitude},${this.currentPositionHover.longitude}|name:终点&mode=driving&output=html&src=webapp.baidu.openAPIdemo`)}`
+						})
+						break;
+					case '高德地图':
+						uni.navigateTo({
+						  url: `/pages/parkingLists/map_web_view/map_web_view?url=${encodeURIComponent(`//uri.amap.com/navigation?from=${this.currentPosition.longitude},${this.currentPosition.latitude},起点&to=${this.currentPositionHover.longitude},${this.currentPositionHover.latitude},终点&mode=car&policy=1&src=mypage&coordinate=gaode&callnative=0`)}`
+						})
+						break;
+					
+				}
 			},
 			clearSearchInput () {
 				this.searchContent = '';

+ 29 - 123
pages/parkingLock/parkingLock.vue

@@ -26,14 +26,14 @@
 					<view>停车时长</view>
 					<view>{{orderInfo.duration}}</view>
 				</view>
-				<view class="parking-lock-info-item">
+				<!-- <view class="parking-lock-info-item">
 					<view>合计金额</view>
 					<view>{{orderInfo.totalAmount}} 元</view>
 				</view>
 				<view class="parking-lock-info-item">
 					<view>优惠金额</view>
 					<view>{{orderInfo.preferentialAmount}} 元</view>
-				</view>
+				</view> -->
 				<view class="parking-lock-info-item">
 					<view>应缴金额</view>
 					<view class="really-money">{{orderInfo.payAmount}} 元</view>
@@ -74,27 +74,12 @@
 		<view class="parking-lock-pay" v-else-if="parkingLockStatus === 5">
 			<view class="parking-lock-tips">{{tipsMsg}}</view>
 		</view>
-		<!-- 缴费方式-->
-		<u-modal
-		v-model="payWayPop"
-		:title-style="{color: '#404040'}"
-		title="缴费方式"
-		:show-confirm-button="false"
-		:show-cancel-button="false">
-			<view class="slot-content">
-				<view class="pay-way">
-					<view class="pay-way-item" @click="gyBankPay">
-						<image src="../../static/img/gy-bank-pay-icon.png" mode=""></image>
-						<view>贵州银行</view>
-					</view>
-					<view class="pay-way-item" @click="wechatPay">
-						<image src="../../static/img/wechat-pay-icon.png" mode=""></image>
-						<view>微信支付</view>
-					</view>
-				</view>
-				<button class="pay-way-close-btn" @click="payWayPop = false">关闭</button>
-			</view>
-		</u-modal>
+		<!-- 支付方式 -->
+		<PaymentMethod
+			:payWayPop="payWayPop"
+			:curOrderList="orderList"
+			:deviceNo="deviceNo"
+			@closePaymentMethod="closePaymentMethod"></PaymentMethod>
 		<u-toast ref="uToast" />
 	</view>
 </template>
@@ -102,7 +87,11 @@
 <script>
 	import { config } from './../../common/config'
 	import getUrlParams from "../../utils/getUrlParams.js";
+	import PaymentMethod from '@/pages/paymentMethod/paymentMethod.vue'
 	export default {
+		components: {
+			PaymentMethod
+		},
 		data() {
 			return {
 				// 车位锁状态 1:支付 2:开始开锁 3:开锁中 4:开锁完成
@@ -117,6 +106,7 @@
 				deviceNo: null,
 				// 轮询
 				timer: null,
+				timer1: null,
 				// 订单信息
 				orderInfo: {},
 				// 订单id
@@ -124,7 +114,6 @@
 			}
 		},
 		onLoad(page) {
-			console.log(page)
 			if (page.orderId) {
 				this.getOrderDetails(page.orderId)
 				this.orderList = []
@@ -136,27 +125,23 @@
 				this.parkingLockStatus = 5
 			}
 		},
+		onShow() {
+			this.timer1 = setInterval(() => {
+				this.getOrderDetails(this.orderId)
+			}, 5000)
+		},
+		onHide() {
+			if (this.timer) {
+				clearInterval(this.timer)
+			}
+			if (this.timer1) {
+				clearInterval(this.timer1)
+			}
+		},
 		methods: {
 			payMoney() {
 				this.payWayPop = true
 			},
-			// 查询订单状态
-			// getOrderStatus(orderId) {
-			// 	this.$u.api.getOrderInfo({orderId: orderId})
-			// 		.then(res => {
-			// 			if (res.code === 200) {
-			// 				if (res.data.payStatus === 0 || res.data.payStatus === 3) {
-			// 					this.getOrderDetails(orderId)
-			// 				} else {
-			// 					this.parkingLockStatus = 2
-			// 					setTimeout(() => {
-			// 						this.parkingLockStatus = 3
-			// 					}, 300)
-			// 					this.checkEqupment()
-			// 				}
-			// 			}
-			// 		})
-			// },
 			// 查询订单信息
 			getOrderDetails(id) {
 				this.$u.api.getOrderDetail({id: id})
@@ -165,6 +150,7 @@
 						if (res.code === 200) {
 							this.orderInfo = res.data
 							if (res.data.payStatus === 1) {
+								clearInterval(this.timer1)
 								this.checkEqupment()
 							}
 						}
@@ -198,88 +184,8 @@
 			cancel() {
 				window.location.href = config.jumpHomeUrl
 			},
-			// 贵阳银行支付
-			gyBankPay() {
-				this.$u.api.payGzbank({
-						orderList: this.orderList,
-						deviceNo: this.deviceNo,
-						jumpUrl: window.location.href
-					}).then(res=>{
-						let payUrl = res.data.url;
-						this.currentPayUrl=encodeURIComponent(res.data.url);
-						this.$u.route({
-							url: 'pages/payLists/pay',
-							params: {
-								currentPayUrl: this.currentPayUrl
-							}
-						});
-				}).catch(err=>{
-					this.$refs.uToast.show({
-						title: err.msg,
-						type: 'error',
-					});
-				});
-			},
-			// 微信支付
-			wechatPay() {
-				const openId = this.$store.state.vuex_wxinfo.openId
-				if (openId) {
-					this.getWXPay(this.orderList)
-				} else {
-					this.getCode()
-				}
-			},
-			async getWXPay(list){
-				let params = {
-					orderList: list,
-					deviceNo: this.deviceNo,
-					openid: this.$store.state.vuex_wxinfo.openId
-				};
-				await this.$wxApi.config();
-				this.$pay.wechatPay(params).then(res =>{
-					if(res.code == 0){
-						// 成功
-						
-					}else if(res.code == 1){
-						// 取消
-						// uni.redirectTo({
-						// 	url: '/pages/userCenter/myOrder/myOrder'
-						// })
-					}else if(res.code == 2){
-						this.$refs.uToast.show({
-							title: '支付失败,请检查!',
-							type: 'error',
-							// url: '/pages/user/index'
-						});
-					}
-					setTimeout(() => {
-						window.location.reload()
-					}, 1000)
-				});
-			},
-			getCode () {
-				var local = window.location.href // 获取页面url
-				let locationLocaturl = window.location.search;
-				this.code = getUrlParams(locationLocaturl, "code"); // 截取code
-				if (this.code == null || this.code === '') { // 如果没有code,则去请求
-					window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.config.wxAppid}&redirect_uri=${encodeURIComponent(local)}&response_type=code&scope=snsapi_userinfo&#wechat_redirect`
-				} else {
-					this.handleGetWXInfo(this.code) //把code传给后台获取用户信息
-				}
-			},
-			handleGetWXInfo (code) { // 通过code获取 openId等用户信息,/api/user/wechat/login 为后台接口
-				this.$u.api.getWXInfo(code).then((res) => {
-					if (res.code === 200 ) {
-						this.$u.vuex('vuex_wxinfo', res.data);
-						// 继续支付
-						this.getWXPay(this.orderList)
-					}
-				}).catch((err) => {
-					this.$refs.uToast.show({
-						title: err.msg,
-						type: 'error',
-					});
-				})
+			closePaymentMethod() {
+				this.payWayPop = false
 			}
 		}
 	}

+ 1 - 5
pages/payLists/pay.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<!-- <web-view  :src="PayUrl"></web-view> -->
+		<!-- <web-view :src="PayUrl"></web-view> -->
 		<a ref="payUrlRef" :href="PayUrl"></a>
 	</view>
 </template>
@@ -13,14 +13,10 @@
 			};
 		},
 		onLoad(page) {
-			// console.log('page',page);
-			// console.log('page1',this.$u.queryParams(page).slice(0));
 			//15是因为传了‘currentPayUrl’,不要更改参数名
 			this.PayUrl = this.$u.queryParams(page).slice(15);
 		},
 		mounted() {
-			// console.log('this.PayUrl',this.PayUrl);
-			// console.log('this.$refs.payUrlRef',this.$refs.payUrlRef);
 			this.$refs.payUrlRef.click();
 		}
 	}

+ 1 - 7
pages/paymentMethod/paymentMethod.vue

@@ -64,13 +64,7 @@
 				};
 				this.$u.api.payGzbank(params).then(res=>{
 					let payUrl = res.data.url;
-					const currentPayUrl = encodeURIComponent(res.data.url);
-					this.$u.route({
-						url: 'pages/payLists/pay',
-						params: {
-							currentPayUrl: currentPayUrl
-						}
-					});
+					window.location.href = payUrl;
 				}).catch(err=>{
 					this.$refs.uToast.show({
 						title: err.msg,

+ 1 - 1
utils/filter.js

@@ -71,7 +71,7 @@ Vue.filter("filterOrderStatus",function(status){
 			return '停放中'
 			break;
 		case 2:
-			return '出场未缴'
+			return '出场未缴'
 			break;
 		case 3:
 			return '欠费'

+ 8 - 1
wxapi.js

@@ -163,8 +163,15 @@ export default {
 						code: 2,
 						msg: err.errMsg.split(':')[1]
 					});
+				},
+				// 无论失败成功都会执行
+				complete(e) {
+					// e.errMsg三种状态 1.chooseWXPay:ok 支付成功 2: chooseWXPay:cancel 支付取消 3:chooseWXPay:fail 支付失败
+					if (e.errMsg === 'chooseWXPay:ok') {
+						window.location.reload()
+					}
 				}
 			});
 		});
-	},
+	}
 }