Ver código fonte

综合一二期代码

空白格 2 anos atrás
pai
commit
249b5543b6

+ 2 - 2
.gitignore

@@ -13,6 +13,6 @@ yarn-error.log*
 *.ntvs*
 *.njsproj
 *.sln
+/unpackage/
+/node_modules
 /package-lock.json
-/.history/
-/node_modules/

+ 2 - 1
README.md

@@ -1,4 +1,6 @@
+
 ## 城市智慧停车(二期)
+
 ### 修改访问地址
 - 如果api地址有变动 修改package.json 中的环境变量配置
 - common/config.js 本地运行地址修改
@@ -7,7 +9,6 @@
 ### 打包
 - 打包测试环境: 发行 => 自定义发行 => build:test
 - 打包正式环境: 发行 => 自定义发行 => build:pro
-
 ### 执行 `npm install`
 
 #### 安装vue-jsonp 获取地址数据跨域处理

+ 0 - 1
common/config.js

@@ -15,7 +15,6 @@ const config = {
 	wxAppid,
 	baseUrl
 }
-
 export {
 	config
 }

+ 3 - 3
common/http.api.js

@@ -100,8 +100,8 @@ const install = (Vue, vm) => {
 	let getOrderStateExportApi = (params = {}) => vm.$u.post(apiurl.getOrderStateExportUrl, params)
 	let quickPayExportApi = (params = {}) => vm.$u.post(apiurl.quickPayExportUrl, params)
 	let polyPayExportApi = (params = {}) => vm.$u.post(apiurl.polyPayExportUrl, params)
-	let getDictApi = (params = {}) => vm.$u.get(apiurl.getDictUrl + params.type)
-  let wechatPayApi = (params = {}) => vm.$u.post(apiurl.wechatPayUrl, params);
+	let getDictApi = (params = {}) => vm.$u.get(apiurl.getDictUrl + params.type);
+	let wechatPayApi = (params = {}) => vm.$u.post(apiurl.wechatPayUrl, params);
 
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
@@ -157,7 +157,7 @@ const install = (Vue, vm) => {
 		getRoomParkingApi,
 		getRoomOrderDetail,
 		getDictApi,
-    wechatPayApi
+		wechatPayApi
 	};
 }
 

+ 3 - 0
manifest.json

@@ -105,6 +105,9 @@
                     "key" : "BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL"
                 }
             }
+        },
+        "devServer" : {
+            "https" : true
         }
     }
 }

+ 0 - 1
pages.json

@@ -297,7 +297,6 @@
 				"navigationBarBackgroundColor": "#008CFF",
 				"navigationBarTextStyle": "white"
 			}
-
 		}
 	],
 	"globalStyle": {

+ 2 - 1
pages/center/phoneLogin/phoneLogin.vue

@@ -122,7 +122,8 @@
 						this.$u.vuex('vuex_token', this.accessToken);
 						this.$u.vuex('vuex_user', res.data);
 						this.$u.vuex('vuex_hasLogin', true);
-						this.jumpIndex()
+						this.wechatLogin()
+
 					} else {
 						this.$refs.uToast.show({
 							title: res.msg,

+ 41 - 5
pages/handleMonthly/handleMonthly.vue

@@ -75,9 +75,10 @@
 
 <script>
 	import getUrlParams from "../../utils/getUrlParams.js";
-	// import {
-	// 	getEnvIsWx
-	// } from '@/utils/judgEnvironment.js'
+	import {
+		getEnvIsWx
+	} from '@/utils/judgEnvironment.js';
+	import $wxPay from '@/utils/wxPay.js'
 	import {
 		monthlyWxPay
 	} from '@/common/http.api.js'
@@ -106,10 +107,12 @@
 				payWayPop: false,
 				jumpUrl: undefined,
 				monthlyContent: '',
-				carLicenseDefaultValue: [0]
+				carLicenseDefaultValue: [0],
+				wxEnv: false
 			}
 		},
-		onLoad (page) {
+		onLoad(page) {
+			this.wxEnv = getEnvIsWx();
 			this.getSysterms(0)
 			if (page.vehicleNo && page.vehicleNo) {
 				this.roadNo = page.roadNo;
@@ -287,6 +290,39 @@
 				// }
 				this.getWXPayByJava()
 			},
+			/**
+			 * 微信支付
+			 */
+			wechatPay() {
+				this.$u.api.wechatPayApi({
+					orderList: this.curOrderList,
+					openid: this.vuex_wxinfo.openId
+				}).then(res => {
+					if (res.code === 200) {
+						$wxPay.wexinPay(res.data.wx).then(res1 => {
+							switch (Number(res1.code)) {
+								case 0: // 成功
+									//#ifdef H5
+									window.location.reload();
+									//#endif
+									break;
+								case 1: // 取消
+									this.$refs.uToast.show({
+										title: '已取消支付',
+										type: 'info'
+									});
+									break;
+								case 2: // 支付失败
+									this.$refs.uToast.show({
+										title: '支付失败,请检查!',
+										type: 'error'
+									});
+									break;
+							}
+						})
+					}
+				})
+			},
 			/**
 			 * 调起微信支付接口
 			 * @param {Array} list 需要支付的订单组合数组

+ 2 - 2
pages/parkingLists/parkingLists.scss

@@ -76,13 +76,13 @@
 }
 .parking-current-address {
 	position: absolute;
-	bottom: 84rpx;
+	bottom: 80rpx;
 	z-index: 1000;
 	width: 100%;
 	height: 345rpx;
 }
 .parking-current-address .swiper {
-	height: 400rpx;
+	height: 430rpx;
 }
 .parking-current-address .swiper-item {
 	background-color: #fff;

+ 352 - 331
pages/parkingLists/parkingLists.vue

@@ -1,46 +1,66 @@
 <template>
 	<view class="parking">
-		<view class="loading" v-show="loading">
-			<u-loadmore status="loading" icon-type="flower" :load-text="{loading: '正在定位中...',}" />
-		</view>
+		<view class="loading" v-show="loading"><u-loadmore status="loading" icon-type="flower" :load-text="{ loading: '正在定位中...' }" /></view>
 		<view class="parking-header">
-			<u-search placeholder="搜索停车场" v-model="searchContent" :show-action="false" @change="searchInputChange">
-			</u-search>
-			<u-icon v-if="!searchContent&&isShowSearchParking==false" class="icon" name="list" size="44" color="#ffffff"
-				placeholder-color="#B5B5B5" search-icon-color="#B3B3B3" @click="listIconClick"></u-icon>
-			<u-icon v-if="searchContent||isShowSearchParking==true" class="icon" name="close" size="36" color="#ffffff"
-				placeholder-color="#B5B5B5" search-icon-color="#B3B3B3" @click="clearSearchInput"></u-icon>
+			<u-search placeholder="搜索停车场" v-model="searchContent" :show-action="false" @change="searchInputChange"></u-search>
+			<u-icon
+				v-if="!searchContent && isShowSearchParking == false"
+				class="icon"
+				name="list"
+				size="44"
+				color="#ffffff"
+				placeholder-color="#B5B5B5"
+				search-icon-color="#B3B3B3"
+				@click="listIconClick"
+			></u-icon>
+			<u-icon
+				v-if="searchContent || isShowSearchParking == true"
+				class="icon"
+				name="close"
+				size="36"
+				color="#ffffff"
+				placeholder-color="#B5B5B5"
+				search-icon-color="#B3B3B3"
+				@click="clearSearchInput"
+			></u-icon>
 		</view>
 		<view class="parking-map">
-			<map id="pagemap" style="width: 100%; height: calc(100vh - 240rpx);" :show-location="true"
-				:latitude="latitude" :longitude="longitude" @markertap="markertap" :enable-traffic="true"
-				:enable-zoom="true" :scale="scale" :markers="covers"></map>
+			<map
+				id="pagemap"
+				style="width: 100%; height: calc(100vh - 240rpx);"
+				:show-location="true"
+				:latitude="latitude"
+				:longitude="longitude"
+				@markertap="markertap"
+				:enable-traffic="true"
+				:enable-zoom="true"
+				:scale="scale"
+				:markers="covers"
+			></map>
 		</view>
 		<view class="parking-current-address" v-if="nearParkingFlag">
-			<swiper class="swiper" :current="swiperCurrent" :indicator-dots="false" :autoplay="false"
-				previous-margin="30rpx" next-margin="30rpx" @change="swiperChange">
+			<swiper class="swiper" :current="swiperCurrent" :indicator-dots="false" :vertical="true" :autoplay="false" previous-margin="30rpx" next-margin="30rpx" @change="swiperChange">
 				<swiper-item v-for="(item, index) in nearParkingList" :key="index + 'n'">
 					<view class="swiper-item">
-						<view @click="clickSearchParking(item)">{{item.roadName}}</view>
-						<view>{{item.areaName}}</view>
+						<view @click="clickSearchParking(item)">{{ item.roadName }}</view>
+						<view>{{ item.areaName }}</view>
 						<view class="swiper-item-font">
 							<view>
 								<text>空闲车位</text>
-								<text class="yellow-font">{{item.spaceIdle}}</text>
+								<text class="yellow-font">{{ item.spaceIdle }}</text>
 							</view>
 							<view v-if="item.monthAmount">
 								<text>包月费用</text>
-								<text class="yellow-font">{{item.monthAmount}}元</text>
+								<text class="yellow-font">{{ item.monthAmount }}元</text>
 							</view>
 							<view>
 								<text>距离</text>
-								<text>{{item.distance | kmUnit}}</text>
+								<text>{{ item.distance | kmUnit }}</text>
 							</view>
 						</view>
 						<view class="swiper-item-button">
 							<button type="default" @click="navigation(item.latitude, item.longitude)">导航</button>
-							<button type="default" :disabled="!item.monthAmount"
-								:class="{'disabled': !item.monthAmount }" @click="createMonth(item)">办理包月</button>
+							<button type="default" :disabled="!item.monthAmount" :class="{ disabled: !item.monthAmount }" @click="createMonth(item)">办理包月</button>
 						</view>
 						<view @click="lookParkingRule(item)">
 							<text>点击查看停车规则</text>
@@ -51,15 +71,13 @@
 			</swiper>
 		</view>
 		<view class="parking-address-list" v-if="isShowSearchParking">
-			<view class="parking-address-list-item" v-for="(item, index) in searchParkingList" :key="index + 's'"
-				@click="clickSearchParking(item)">
+			<view class="parking-address-list-item" v-for="(item, index) in searchParkingList" :key="index + 's'" @click="clickSearchParking(item)">
 				<view class="pali-left">
-					<view>{{item.roadName}}</view>
-					<view>{{item.areaName}}</view>
+					<view>{{ item.roadName }}</view>
+					<view>{{ item.areaName }}</view>
 				</view>
 				<view class="pali-right">
-					<image src="../../static/img/distance-icon.png" mode=""
-						@click.stop="navigation(item.latitude, item.longitude)"></image>
+					<image src="../../static/img/distance-icon.png" mode="" @click.stop="navigation(item.latitude, item.longitude)"></image>
 					<view>路线</view>
 				</view>
 			</view>
@@ -71,332 +89,335 @@
 </template>
 
 <script>
-	import {
-		qqMapTransBMap
-	} from '../../utils/mapTrans.js'
-	export default {
-		data() {
-			return {
-				searchContent: '',
-				page_map: '',
-				loading: false,
+import { qqMapTransBMap } from '../../utils/mapTrans.js';
+export default {
+	data() {
+		return {
+			searchContent: '',
+			page_map: '',
+			loading: false,
+			latitude: 26.64969,
+			longitude: 106.636453,
+			scale: 16,
+			currentPosition: {
 				latitude: 26.64969,
-				longitude: 106.636453,
-				scale: 16,
-				currentPosition: {
-					latitude: 26.64969,
-					longitude: 106.636453
+				longitude: 106.636453
+			},
+			covers: [],
+			// 附近列表是否显示
+			nearParkingFlag: false,
+			// 轮播选中
+			swiperCurrent: 0,
+			// 附近停车列表
+			nearParkingList: [],
+			// 是否显示停车场列表
+			isShowSearchParking: false,
+			// 搜索停车场列表
+			searchParkingList: [],
+			// 显示单个停车场数据
+			isShowParkingDetail: false,
+			// 单个停车场数据
+			parkingDetailData: {},
+			mapSelect: false,
+			mapSelectList: [
+				{
+					value: '1',
+					label: '腾讯地图'
 				},
-				covers: [],
-				// 附近列表是否显示
-				nearParkingFlag: false,
-				// 轮播选中
-				swiperCurrent: 0,
-				// 附近停车列表
-				nearParkingList: [],
-				// 是否显示停车场列表
-				isShowSearchParking: false,
-				// 搜索停车场列表
-				searchParkingList: [],
-				// 显示单个停车场数据
-				isShowParkingDetail: false,
-				// 单个停车场数据
-				parkingDetailData: {},
-				mapSelect: false,
-				mapSelectList: [{
-						value: '1',
-						label: '腾讯地图'
-					},
-					// {
-					//  value: '2',
-					//  label: '百度地图'
-					// },
-					{
-						value: '3',
-						label: '高德地图'
-					}
-				],
-				// 选中位置经纬度
-				currentPositionHover: {}
+				// {
+				//  value: '2',
+				//  label: '百度地图'
+				// },
+				{
+					value: '3',
+					label: '高德地图'
+				}
+			],
+			// 选中位置经纬度
+			currentPositionHover: {}
+		};
+	},
+	onLoad(page) {
+		this.getLocation();
+		// this.getNearRoadsl()
+		if (page.keyword) {
+			this.searchContent = page.keyword;
+			this.searchInputChange(page.keyword);
+		}
+	},
+	methods: {
+		/**
+		 * 查询输入框发生变化
+		 * @date 2021-08-10
+		 * @param {String} value
+		 */
+		searchInputChange(value) {
+			// 为空时关闭搜索列表
+			if (value === '') {
+				this.isShowSearchParking = false;
 			}
+			this.isShowParkingDetail = false;
+			this.getNearRoadsl();
 		},
-		onLoad(page) {
-			this.getLocation()
-			// this.getNearRoadsl()
-			if (page.keyword) {
-				this.searchContent = page.keyword
-				this.searchInputChange(page.keyword)
+		/**
+		 * 获取定位
+		 * @date 2021-08-10
+		 * @returns {any}
+		 */
+		getLocation() {
+			const that = this;
+			console.log('请求定位');
+			that.loading = true;
+
+			if (navigator.geolocation) {
+				// 判断是否有这个对象
+				navigator.geolocation.getCurrentPosition(function(pos) {
+					console.log('经度:' + pos.coords.longitude + '纬度:' + pos.coords.latitude);
+					that.latitude = pos.coords.latitude;
+					that.longitude = pos.coords.longitude;
+					that.currentPosition.latitude = pos.coords.latitude;
+					that.currentPosition.longitude = pos.coords.longitude;
+					that.loading = false;
+					that.getNearRoadsl();
+				});
+			} else {
+				this.$refs.uToast.show({
+					title: '当前系统不支持GPS API',
+					type: 'error'
+				});
 			}
 		},
-		methods: {
-			/**
-			 * 查询输入框发生变化
-			 * @date 2021-08-10
-			 * @param {String} value
-			 */
-			searchInputChange(value) {
-				// 为空时关闭搜索列表
-				if (value === '') {
-					this.isShowSearchParking = false
-				}
-				this.isShowParkingDetail = false
-				this.getNearRoadsl()
-			},
-			/**
-			 * 获取定位
-			 * @date 2021-08-10
-			 * @returns {any}
-			 */
-			getLocation() {
-				const that = this
-				console.log('请求定位')
-				that.loading = true
-
-				if (navigator.geolocation) {
-					// 判断是否有这个对象
-					navigator.geolocation.getCurrentPosition(function(pos) {
-						console.log('经度:' + pos.coords.longitude + '纬度:' + pos.coords.latitude)
-						that.latitude = pos.coords.latitude
-						that.longitude = pos.coords.longitude
-						that.currentPosition.latitude = pos.coords.latitude
-						that.currentPosition.longitude = pos.coords.longitude
-						that.loading = false
-						that.getNearRoadsl()
-					})
-				} else {
-					this.$refs.uToast.show({
-						title: '当前系统不支持GPS API',
-						type: 'error'
-					})
-				};
-			},
-			/**
-			 * 导航
-			 * @date 2021-08-10
-			 * @param {Number} latitude
-			 * @param {Number} longitude
-			 * @returns {any}
-			 */
-			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:'+latitude+','+longitude+'&referer=myApp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL'
-				// })
-				/* 组件多地图调用 */
-				// this.nearParkingFlag = false
-				// var options = {
-				//     destination:{  // 导航终点点坐标和名称
-				//         latitude: latitude,
-				//         longitude: longitude,
-				//         name: "终点"
-				//     },
-				//     mapId: "map" // map 组件的 id (微信小程序端必传)
-				// }
-				// Map.navigation(options)
-			},
-			// 多地图选择
-			mapSelectConfirm(item) {
-				const name = item[0].label
-				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 '百度地图':
-						const bdOriginPoint = qqMapTransBMap(this.currentPosition.longitude, this.currentPosition
-							.latitude) // 起点坐标
-						const bdCurrPoint = qqMapTransBMap(this.currentPositionHover.longitude, this.currentPositionHover
-							.latitude) // 终点坐标
-						const baiduMap = 'https://map.baidu.com/mobile/webapp/index/index/foo=bar/vt=map'
-						const bdurl =
-							`https://api.map.baidu.com/direction?origin=latlng:${bdOriginPoint.lat},${bdOriginPoint.lng}|name:起点&destination=latlng:${bdCurrPoint.lat},${bdCurrPoint.lng}|name:终点&mode=driving&output=html&src=webapp.baidu.openAPIdemo`
-						console.log('百度地图theurl', bdurl)
-						window.location.href = baiduMap
-						break
-					case '高德地图':
-						const gdurl =
-							`https://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`
-						console.log('高德地图theurl', gdurl)
-						window.location.href = gdurl
-						// window.open(url, "_blank", "scrollbars=yes,resizable=1,modal=false,alwaysRaised=yes");
-						// 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
-				}
-			},
-			/**
-			 * 清空搜索框内容
-			 * @date 2021-08-10
-			 * @returns {any}
-			 */
-			clearSearchInput() {
-				this.searchContent = ''
-				this.isShowSearchParking = false
-				this.getNearRoadsl()
-			},
-			/**
-			 * 默认首个点放大 如果有传入经纬度则对应的点放大
-			 * @date 2021-08-10
-			 * @param {Number} lon
-			 * @param {Number} lat
-			 * @returns {any}
-			 */
-			getNearRoadsl(lon, lat) {
-				this.$u.api.nearRoadsl({
-						latitude: this.currentPosition.latitude,
-						longitude: this.currentPosition.longitude,
-						roadName: this.searchContent
-					})
-					.then(res => {
-						const nearParkingList = [] // 附近停车场列表
-						this.covers = []
-						res.data.forEach((item, index, arr) => {
-							if (item.latitude && item.longitude) {
-								nearParkingList.push(item)
-								const marker = {
-									latitude: item.latitude,
-									longitude: item.longitude,
-									id: String(index),
-									iconPath: require('./../../static/img/parking-icon.png'),
-									width: 20,
-									height: 25
+		/**
+		 * 导航
+		 * @date 2021-08-10
+		 * @param {Number} latitude
+		 * @param {Number} longitude
+		 * @returns {any}
+		 */
+		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:'+latitude+','+longitude+'&referer=myApp&key=BOGBZ-2BZ33-O4L32-Y3QJR-PGN66-RFFEL'
+			// })
+			/* 组件多地图调用 */
+			// this.nearParkingFlag = false
+			// var options = {
+			//     destination:{  // 导航终点点坐标和名称
+			//         latitude: latitude,
+			//         longitude: longitude,
+			//         name: "终点"
+			//     },
+			//     mapId: "map" // map 组件的 id (微信小程序端必传)
+			// }
+			// Map.navigation(options)
+		},
+		// 多地图选择
+		mapSelectConfirm(item) {
+			const name = item[0].label;
+			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 '百度地图':
+					const bdOriginPoint = qqMapTransBMap(this.currentPosition.longitude, this.currentPosition.latitude); // 起点坐标
+					const bdCurrPoint = qqMapTransBMap(this.currentPositionHover.longitude, this.currentPositionHover.latitude); // 终点坐标
+					const baiduMap = 'https://map.baidu.com/mobile/webapp/index/index/foo=bar/vt=map';
+					const bdurl = `https://api.map.baidu.com/direction?origin=latlng:${bdOriginPoint.lat},${bdOriginPoint.lng}|name:起点&destination=latlng:${bdCurrPoint.lat},${
+						bdCurrPoint.lng
+					}|name:终点&mode=driving&output=html&src=webapp.baidu.openAPIdemo`;
+					console.log('百度地图theurl', bdurl);
+					window.location.href = baiduMap;
+					break;
+				case '高德地图':
+					const gdurl = `https://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`;
+					console.log('高德地图theurl', gdurl);
+					window.location.href = gdurl;
+					// window.open(url, "_blank", "scrollbars=yes,resizable=1,modal=false,alwaysRaised=yes");
+					// 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;
+			}
+		},
+		/**
+		 * 清空搜索框内容
+		 * @date 2021-08-10
+		 * @returns {any}
+		 */
+		clearSearchInput() {
+			this.searchContent = '';
+			this.isShowSearchParking = false;
+			this.getNearRoadsl();
+		},
+		/**
+		 * 默认首个点放大 如果有传入经纬度则对应的点放大
+		 * @date 2021-08-10
+		 * @param {Number} lon
+		 * @param {Number} lat
+		 * @returns {any}
+		 */
+		getNearRoadsl(lon, lat) {
+			this.$u.api
+				.nearRoadsl({
+					latitude: this.currentPosition.latitude,
+					longitude: this.currentPosition.longitude,
+					roadName: this.searchContent
+				})
+				.then(res => {
+					const nearParkingList = []; // 附近停车场列表
+					this.covers = [];
+					res.data.forEach((item, index, arr) => {
+						if (item.latitude && item.longitude) {
+							nearParkingList.push(item);
+							const marker = {
+								latitude: item.latitude,
+								longitude: item.longitude,
+								id: String(index),
+								iconPath: require('./../../static/img/parking-icon.png'),
+								width: 20,
+								height: 25
+							};
+							// 选中经纬度图标变大
+							if (lon && lat) {
+								if (lon === item.longitude && lat === item.latitude) {
+									marker.width = 40;
+									marker.height = 50;
 								}
-								// 选中经纬度图标变大
-								if (lon && lat) {
-									if (lon === item.longitude && lat === item.latitude) {
-										marker.width = 40
-										marker.height = 50
-									}
-								} else {
-									if (this.covers.length > 0) {
-										this.covers[0].width = 40
-										this.covers[0].height = 50
-									}
+							} else {
+								if (this.covers.length > 0) {
+									this.covers[0].width = 40;
+									this.covers[0].height = 50;
 								}
-								this.covers.push(marker)
 							}
-						})
-						this.nearParkingList = nearParkingList
-						if (nearParkingList.length > 0) {
-							this.latitude = nearParkingList[0]?.latitude || this.currentPosition.latitude
-							this.longitude = nearParkingList[0]?.longitude || this.currentPosition.longitude
-						} else {
-							this.$refs.uToast.show({
-								title: '没有相关停车场信息',
-								type: 'warning'
-							})
-						}
-						this.nearParkingFlag = true
-						if (this.searchContent) {
-							this.searchParkingList = nearParkingList
-							this.isShowSearchParking = true
-							this.nearParkingFlag = false
+							this.covers.push(marker);
 						}
-					}).catch(err => {
+					});
+					this.nearParkingList = nearParkingList;
+					if (nearParkingList.length > 0) {
+						this.latitude = nearParkingList[0]?.latitude || this.currentPosition.latitude;
+						this.longitude = nearParkingList[0]?.longitude || this.currentPosition.longitude;
+					} else {
 						this.$refs.uToast.show({
-							title: err.msg,
-							type: 'error'
-						})
-					})
-			},
-			/**
-			 * 点击地图上的标记点触发
-			 **/
-			markertap(e) {
-				let lon, lat
-				this.covers.forEach((item, index) => {
-					if (e.detail.markerId === item.id) {
-						lon = item.longitude
-						lat = item.latitude
-						this.swiperCurrent = index
+							title: '没有相关停车场信息',
+							type: 'warning'
+						});
 					}
-				})
-				this.getNearRoadsl(lon, lat)
-			},
-			/**
-			 * 地址发生变化
-			 * @date 2021-08-10
-			 * @param {Object} item
-			 * @returns {any}
-			 */
-			swiperChange(item) {
-				const map = uni.createMapContext('pagemap')
-				map.moveToLocation({
-					longitude: this.nearParkingList[item.detail.current].longitude,
-					latitude: this.nearParkingList[item.detail.current].latitude
-				})
-				this.getNearRoadsl(this.nearParkingList[item.detail.current].longitude, this.nearParkingList[item.detail
-					.current].latitude)
-			},
-			/**
-			 * 点击单个停车场看详情
-			 * @date 2021-08-10
-			 * @param {Object} item 为选中项参数
-			 * @returns {any}
-			 */
-			clickSearchParking(item) {
-				if (item.monthAmount) {
-					this.$u.route({
-						url: 'pages/parkingInformation/parkingInformation',
-						params: {
-							roadInfo: JSON.stringify(item)
-						}
-					})
-				}
-			},
-			/**
-			 * 跳转停车标准页面
-			 * @date 2021-08-10
-			 * @param {Object} item
-			 * @returns {any}
-			 */
-			lookParkingRule(item) {
-				this.$u.route({
-					url: 'pages/chargeStandard/chargeStandard',
-					params: {
-						roadNo: item.roadNo
+					this.nearParkingFlag = true;
+					if (this.searchContent) {
+						this.searchParkingList = nearParkingList;
+						this.isShowSearchParking = true;
+						this.nearParkingFlag = false;
 					}
 				})
-			},
-			/**
-			 * 搜索右侧按钮点击
-			 **/
-			listIconClick() {
-				this.isShowSearchParking = true
-				this.nearParkingFlag = false
-				this.searchParkingList = this.nearParkingList
-			},
-			/**
-			 * 跳转包月
-			 * @date 2021-08-10
-			 * @param {Object} item
-			 * @returns {any}
-			 */
-			createMonth(item) {
+				.catch(err => {
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error'
+					});
+				});
+		},
+		/**
+		 * 点击地图上的标记点触发
+		 **/
+		markertap(e) {
+			let lon, lat;
+			this.covers.forEach((item, index) => {
+				if (e.detail.markerId === item.id) {
+					lon = item.longitude;
+					lat = item.latitude;
+					this.swiperCurrent = index;
+				}
+			});
+			this.getNearRoadsl(lon, lat);
+		},
+		/**
+		 * 地址发生变化
+		 * @date 2021-08-10
+		 * @param {Object} item
+		 * @returns {any}
+		 */
+		swiperChange(item) {
+			const map = uni.createMapContext('pagemap');
+			map.moveToLocation({
+				longitude: this.nearParkingList[item.detail.current].longitude,
+				latitude: this.nearParkingList[item.detail.current].latitude
+			});
+			this.getNearRoadsl(this.nearParkingList[item.detail.current].longitude, this.nearParkingList[item.detail.current].latitude);
+		},
+		/**
+		 * 点击单个停车场看详情
+		 * @date 2021-08-10
+		 * @param {Object} item 为选中项参数
+		 * @returns {any}
+		 */
+		clickSearchParking(item) {
+			if (item.monthAmount) {
 				this.$u.route({
-					url: 'pages/handleMonthly/handleMonthly',
+					url: 'pages/parkingInformation/parkingInformation',
 					params: {
-						roadNo: item.roadNo
+						roadInfo: JSON.stringify(item)
 					}
-				})
+				});
 			}
+		},
+		/**
+		 * 跳转停车标准页面
+		 * @date 2021-08-10
+		 * @param {Object} item
+		 * @returns {any}
+		 */
+		lookParkingRule(item) {
+			this.$u.route({
+				url: 'pages/chargeStandard/chargeStandard',
+				params: {
+					roadNo: item.roadNo
+				}
+			});
+		},
+		/**
+		 * 搜索右侧按钮点击
+		 **/
+		listIconClick() {
+			this.isShowSearchParking = true;
+			this.nearParkingFlag = false;
+			this.searchParkingList = this.nearParkingList;
+		},
+		/**
+		 * 跳转包月
+		 * @date 2021-08-10
+		 * @param {Object} item
+		 * @returns {any}
+		 */
+		createMonth(item) {
+			this.$u.route({
+				url: 'pages/handleMonthly/handleMonthly',
+				params: {
+					roadNo: item.roadNo
+				}
+			});
 		}
 	}
+};
 </script>
 
 <style lang="scss" scoped>
-	.wrap {
-		margin-top: 20vh;
-	}
+.wrap {
+	margin-top: 20vh;
+}
 
-	@import url("./parkingLists.scss");
+@import url('./parkingLists.scss');
 </style>

+ 98 - 0
pages/payPage/payPage.scss

@@ -0,0 +1,98 @@
+.order-info{
+	margin-top: 50rpx;
+	margin-bottom: 75rpx;
+	.order-info-top{
+		position: relative;
+		border-top-left-radius: 20rpx;
+		border-top-right-radius: 20rpx;
+		color: #fff;
+		padding: 35rpx 40rpx;
+		background: linear-gradient(135deg, #00BFFF 0%, #008DFF 100%);
+		.addr{
+			margin-bottom: 16rpx;
+			.addr-text{
+				margin-left: 17rpx;
+				font-size: 24rpx;
+				font-weight: 400;
+			}
+		}
+		.car{
+			.car-no{
+				font-size: 40rpx;
+				font-weight: 500;
+				color: #FFFFFF;
+				letter-spacing: 1px;
+				line-height: 56rpx;
+				margin-right: 13rpx;
+			}
+			.car-type{
+				font-size: 24rpx;
+			}
+		}
+		.time{
+			font-size: 22rpx;
+			font-weight: 400;
+			color: #CDECFF;
+			line-height: 30rpx;
+			margin-bottom: 3rpx;
+		}
+		.duration{
+			margin-top: 17rpx;
+			font-size: 30rpx;
+			font-weight: 400;
+			color: #FFFFFF;
+			line-height: 42rpx;
+			letter-spacing: 1px;
+		}
+		.total-amount{
+			position: absolute;
+			right: 40rpx;
+			bottom: 25rpx;
+			font-size: 60rpx;
+			font-weight: 500;
+			color: #FFFFFF;
+			letter-spacing: 2rpx;
+		}
+	}
+	.order-info-bottom{
+		padding-top: 44rpx;
+		padding-bottom: 56rpx;
+		background: #FFFFFF;
+		border-bottom-left-radius: 20rpx;
+		border-bottom-right-radius: 20rpx;
+		box-shadow: 0px 6rpx 14rpx 0px rgba(200, 200, 200, 0.5);
+		.u-cell{padding-left: 40rpx;padding-right: 40rpx;}
+		/deep/ .u-iconfont{color: #D8D8D8;}
+		.pay-amount{
+			border-top: 1px solid #CACACA;
+			padding-top: 33rpx;
+			padding: 33rpx 40rpx 9rpx;
+			color: #FF751D;
+			.title{
+				font-size: 30rpx;
+				font-weight: 600;
+				color: #FF751D;
+				line-height: 42rpx;
+				letter-spacing: 1px;
+			}
+			.amount{
+				font-size: 36rpx;
+				font-weight: 600;
+				color: #FF8233;
+				line-height: 33rpx;
+				letter-spacing: 1px;
+				.rmb{
+					font-size: 24rpx;
+					margin-right: 5rpx;
+				}
+			}
+		}
+		.tip{
+			font-size: 22rpx;
+			font-weight: 400;
+			color: #999999;
+			line-height: 30rpx;
+			padding: 0 40rpx;
+		}
+	}
+}

+ 150 - 0
pages/payPage/payPage.vue

@@ -0,0 +1,150 @@
+<template>
+	<view class="wrap">
+		<view class="order-info">
+			<view class="order-info-top">
+				<view class="addr u-flex">
+					<u-icon name="map-fill" color="#fff" size="28"></u-icon>
+					<view class="addr-text">{{orderInfo.roadName}}</view>
+				</view>
+				<view class="car u-flex">
+					<view class="car-no">{{orderInfo.vehicleNo}}</view>
+					<view class="car-type">临时车</view>
+				</view>
+				<view class="time in-time">进场时间:{{orderInfo.inTime}}</view>
+				<view class="time out-time">进场时间:{{orderInfo.outTime}}</view>
+				<view class="duration">已停放 {{orderInfo.duration}}</view>
+				<view class="total-amount">¥{{orderInfo.totalAmount}}</view>
+			</view>
+			<view class="order-info-bottom">
+				<u-cell-item 
+				center 
+				:border-bottom="false" 
+				:value="orderInfo.preferentialAmount" 
+				:title-style="{color:'#8A8A8A'}"
+				:icon-style="{color:'#D8D8D8'}"
+				title="已优惠"></u-cell-item>
+				<view class="pay-amount u-flex u-row-between">
+					<view class="title">应付金额</view>
+					<view class="amount"><span class="rmb">¥</span>{{orderInfo.payAmount}}</view>
+				</view>
+				<view class="tip">停车费不超过30元,可先离场后在付费</view>
+			</view>
+		</view>
+		<view class="bottom-btn static" @click="handlewxpay">去支付</view>
+		
+		<u-toast ref="uToast" />
+	</view>
+</template>
+
+<script>
+	import getUrlParams from "../../utils/getUrlParams.js";
+	export default{
+		data(){
+			return{
+				orderId:null,
+				orderInfo:[],
+				
+			}
+		},
+		onLoad(){
+			let locationLocaturl = window.location.hash;
+			this.orderId = getUrlParams(locationLocaturl,"orderId"); // 截取orderId
+			console.log('this.orderId',this.orderId);
+			this.handleGetOrderinfo(this.orderId);
+			
+		},
+		methods:{
+			handleGetOrderinfo(orderId){
+				this.$u.api.getOrderinfo({id:orderId})
+				.then(res=>{
+					// this.$refs.uToast.show({
+					// 	title: res.msg,
+					// 	type: 'success',
+					// });
+					this.orderInfo = res.data;
+					console.log('handleGetOrderinfo',JSON.parse(JSON.stringify(res)));
+				}).catch(err=>{
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+					console.log('handleGetOrderinfo ',err)
+				});
+				
+			},
+			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 为后台接口
+				let _this = this
+				this.$u.api.getWXInfo(code).then((res) => {
+					if (res.code === 200 ) {
+						this.$u.vuex('vuex_wxinfo',res.data);
+						// 继续支付
+					}
+				}).catch((err) => {
+					this.$refs.uToast.show({
+						title: err.msg,
+						type: 'error',
+					});
+				})
+			},			
+			handlewxpay(){;
+				if(!this.$store.state.vuex_wxinfo.openId){ // 如果微信openId,则需用code去后台获取
+					this.$refs.uToast.show({
+						title: '请登录后重试!',
+						type: 'info',
+						// url: '/pages/user/index'
+					});
+					this.getCode();
+				} else {
+					// 别的业务逻辑
+					this.getWXPay();
+				}
+			},
+			async getWXPay(id){
+				let params = {
+					orderId:this.orderId,
+					openid:this.$store.state.vuex_wxinfo.openId,
+					tradeType:"test"
+				};
+				await this.$wxApi.config();
+				this.$pay.wxPay(params).then(res =>{
+					console.log('wxPay',res.code);
+					if(res.code == 0){
+						// 成功
+						this.$u.route({
+							url:'pages/index/index',
+							// params: {
+							// 	keyword: this.keyword
+							// }
+						});
+					}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'
+						});
+					}
+				});
+			},
+			
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import "./payPage.scss";
+</style>

+ 206 - 202
pages/paymentMethod/paymentMethod.vue

@@ -3,79 +3,83 @@
 		支付方式选择  微信or贵阳银行
 	 -->
 	<view>
-		<u-modal v-model="payWayPop" :title-style="{color: '#404040'}" title="缴费方式" :show-confirm-button="false"
-			:show-cancel-button="false">
+		<u-modal v-model="payWayPop" :title-style="{ color: '#404040' }" title="缴费方式" width="660rpx"
+			:show-confirm-button="false" :show-cancel-button="false">
 			<view class="slot-content">
 				<view class="pay-way-new">
 					<!-- <view class="pay-way-item pay-way-item-hy" @click="gyBankPay">
 						<image src="../../static/img/guiyang-bank-icon.png" mode=""></image>
 						<view class="title">贵州银行</view>
-						<view class="subtitle">前三个月每天首次一分钱<br />长期八折优惠</view>
+						<view class="subtitle">前三个月每天首次一分钱<br/>长期八折优惠</view>
 					</view>
 					<view class="pay-way-item pay-way-item-jh" @click="wechatPay">
 						<image src="../../static/img/juhe-icon.png" mode=""></image>
 						<view class="title">微信/支付宝</view>
 					</view> -->
-          <view class="pay-way-item pay-way-item-hy" @click="$u.debounce(gyBankPay, 1000, (immediate = true))">
-            <image src="/static/img/gyyh-icon.svg" mode=""></image>
-            <view class="title">贵州银行</view>
-          </view>
-          <!-- #ifdef H5 || MP-WEIXIN -->
-          <view class="pay-way-item pay-way-item-wx" @click="$u.debounce(wechatPay, 1000, (immediate = true))" v-if="wxEnv">
-            <image src="/static/img/weixin-icon.svg" mode=""></image>
-            <view class="title">微信支付</view>
-          </view>
-          <!-- #endif -->
-          <view class="pay-way-item pay-way-item-jh" @click="$u.debounce(juhePay, 1000, (immediate = true))">
-            <image src="/static/img/juhe-icon.svg" mode=""></image>
-            <view class="title">聚合支付</view>
-          </view>
-        </view>
-        <view class="pay-way-subtitle">
-          <view class="pay-way-subtitle-item">前三个月每天首次一分钱,长期八折优惠</view>
-          <!-- #ifdef H5 || MP-WEIXIN -->
-          <view class="pay-way-subtitle-item" v-if="wxEnv">&nbsp;</view>
-          <!-- #endif -->
-          <view class="pay-way-subtitle-item">&nbsp;</view>
-        </view>
-        <button class="pay-way-close-btn" @click="closePaymentMethod">关闭</button>
-      </view>
-    </u-modal>
-    <u-toast ref="uToast" />
-  </view>
+					<view class="pay-way-item pay-way-item-hy"
+						@click="$u.debounce(gyBankPay, 1000, (immediate = true))">
+						<image src="/static/img/gyyh-icon.svg" mode=""></image>
+						<view class="title">贵州银行</view>
+					</view>
+					<!-- #ifdef H5 || MP-WEIXIN -->
+					<view class="pay-way-item pay-way-item-wx" @click="$u.debounce(wechatPay, 1000, (immediate = true))"
+						v-if="wxEnv">
+						<image src="/static/img/weixin-icon.svg" mode=""></image>
+						<view class="title">微信支付</view>
+					</view>
+					<!-- #endif -->
+					<view class="pay-way-item pay-way-item-jh" @click="$u.debounce(juhePay, 1000, (immediate = true))">
+						<image src="/static/img/juhe-icon.svg" mode=""></image>
+						<view class="title">聚合支付</view>
+					</view>
+				</view>
+				<view class="pay-way-subtitle">
+					<view class="pay-way-subtitle-item">前三个月每天首次一分钱,长期八折优惠</view>
+					<!-- #ifdef H5 || MP-WEIXIN -->
+					<view class="pay-way-subtitle-item" v-if="wxEnv">&nbsp;</view>
+					<!-- #endif -->
+					<view class="pay-way-subtitle-item">&nbsp;</view>
+				</view>
+				<button class="pay-way-close-btn" @click="closePaymentMethod">关闭</button>
+			</view>
+		</u-modal>
+		<u-toast ref="uToast" />
+	</view>
 </template>
 
 <script>
-import { getEnvIsWx } from '@/utils/judgEnvironment.js';
-import $wxPay from '@/utils/wxPay.js';
-export default {
-  props: {
-    // 弹框显示
-    payWayPop: {
-      type: Boolean,
-      default: false
-    },
-    // 订单数组
-    curOrderList: {
-      type: Array,
-      default: null
-    },
-    // 设备编号
-    deviceNo: {
-      type: String,
-      default: null
-    },
-    // 地磁支付需要字段
-    payeeId: {
-      type: String,
-      default: undefined
-    },
-    // 地磁支付需要字段
-    payeeName: {
-      type: String,
-      default: undefined
-    },
-//扫码支付需要字段
+	import {
+		getEnvIsWx
+	} from '@/utils/judgEnvironment.js';
+	import $wxPay from '@/utils/wxPay.js';
+	export default {
+		props: {
+			// 弹框显示
+			payWayPop: {
+				type: Boolean,
+				default: false
+			},
+			// 订单数组
+			curOrderList: {
+				type: Array,
+				default: null
+			},
+			// 设备编号
+			deviceNo: {
+				type: String,
+				default: null
+			},
+			// 地磁支付需要字段
+			payeeId: {
+				type: String,
+				default: undefined
+			},
+			// 地磁支付需要字段
+			payeeName: {
+				type: String,
+				default: undefined
+			},
+			//扫码支付需要字段
 			sanPay: {
 				type: Boolean,
 				default: false
@@ -94,149 +98,149 @@ export default {
 			exportFlag: {
 				type: Boolean,
 				default: false
-    }
-  },
-  data() {
-    return {
-      wxEnv: true
-    };
-  },
-  created() {
-    this.wxEnv = getEnvIsWx();
-  },
-  methods: {
-    /**
-     * 贵阳银行支付
-     * @param {Array} orderList 需要支付的订单号组成的数组
-     * @param {String} deviceNo 设备编号(只有车位锁部分有)
-     * */
-    gyBankPay() {
-      const params = {
-        orderList: this.curOrderList,
-        deviceNo: this.deviceNo,
-        jumpUrl: this.jumpUrl,
-        payeeId: this.payeeId,
-        payeeName: this.payeeName
-      };
-      this.$u.api
-        .payGzbank(params)
-        .then((res) => {
-          if (res.data.needPay) {
-            let payUrl = res.data.url;
-            location.href = payUrl;
-          } else {
-            this.$refs.uToast.show({
-              title: '无需支付',
-              type: 'info'
-            });
-            setTimeout(() => {
-              uni.hideLoading();
-              location.reload();
-            }, 1000);
-          }
-        })
-        .catch((err) => {
-          this.$refs.uToast.show({
-            title: err.msg,
-            type: 'error'
-          });
-        });
-    },
-    /**
-     * 聚合支付
-     * 判断vuex中是否存在openId
-     * 存在直接调起微信支付
-     * 不存在则通过微信登录去获取用户的code
-     * 完成后通过code去获取用户的openId等信息
-     * 最后再调起微信支付
-     * */
-    juhePay() {
-      this.getWXPayByJava(this.curOrderList, this.deviceNo);
-    },
-    /**
-     * 微信支付
-     */
-    wechatPay() {
-      this.$u.api
-        .wechatPayApi({
-          orderList: this.curOrderList,
-          openid: this.vuex_wxinfo.openId,
-          deviceNo: this.deviceNo || undefined,
-          payeeId: this.payeeId || undefined,
-          payeeName: this.payeeName || undefined
-        })
-        .then((res) => {
-          if (res.code === 200) {
-            $wxPay.wexinPay(res.data.wx).then((res1) => {
-              switch (Number(res1.code)) {
-                case 0: // 成功
-                  //#ifdef H5
-                  window.location.reload();
-                  //#endif
-                  break;
-                case 1: // 取消
-                  this.$refs.uToast.show({
-                    title: '已取消支付',
-                    type: 'info'
-                  });
-                  break;
-                case 2: // 支付失败
-                  this.$refs.uToast.show({
-                    title: '支付失败,请检查!',
-                    type: 'error'
-                  });
-                  break;
-              }
-            });
-          }
-        });
-    },
-    /**
-     * 直接通过后台获取贵阳银行微信支付地址
-     * @param {Array} list 需要支付的订单组合数组
-     * @param {Number} deviceNo 设备编号(在停车锁部分需要)
-     * */
-    getWXPayByJava(orderList, deviceNo) {
-      let params = {
-        orderList: orderList,
-        openid: '',
-        jumpUrl: this.jumpUrl,
-        deviceNo: deviceNo ? deviceNo : null,
-        payeeId: this.payeeId,
-        payeeName: this.payeeName
-      };
-      this.$u.api
-        .ordinaryWxPay(params)
-        .then((res) => {
-          if (res.code === 200) {
-            // if (getEnvIsWx()) {
-            // 	location.href = res.data.qrCodeUrl + '&jump_url=' + encodeURIComponent(this.jumpUrl)
-            // } else {
-            // 	location.href = res.data.qrCodeUrl
-            // }
-            localStorage.setItem('jumpUrl', this.jumpUrl);
-            location.href = res.data.qrCodeUrl;
-          } else {
-            uni.hideLoading();
-          }
-        })
-        .catch((err) => {
-          this.$refs.uToast.show({
-            title: '无法调起微信支付!',
-            type: 'error'
-          });
-        });
-    },
-    /**
-     * 关闭弹框
-     * */
-    closePaymentMethod() {
-      this.$emit('closePaymentMethod');
-    }
-  }
-};
+			}
+		},
+		data() {
+			return {
+				wxEnv: true
+			};
+		},
+		created() {
+			this.wxEnv = getEnvIsWx();
+		},
+		methods: {
+			/**
+			 * 贵阳银行支付
+			 * @param {Array} orderList 需要支付的订单号组成的数组
+			 * @param {String} deviceNo 设备编号(只有车位锁部分有)
+			 * */
+			gyBankPay() {
+				const params = {
+					orderList: this.curOrderList,
+					deviceNo: this.deviceNo,
+					jumpUrl: this.jumpUrl,
+					payeeId: this.payeeId,
+					payeeName: this.payeeName
+				};
+				this.$u.api
+					.payGzbank(params)
+					.then((res) => {
+						if (res.data.needPay) {
+							let payUrl = res.data.url;
+							location.href = payUrl;
+						} else {
+							this.$refs.uToast.show({
+								title: '无需支付',
+								type: 'info'
+							});
+							setTimeout(() => {
+								uni.hideLoading();
+								location.reload();
+							}, 1000);
+						}
+					})
+					.catch((err) => {
+						this.$refs.uToast.show({
+							title: err.msg,
+							type: 'error'
+						});
+					});
+			},
+			/**
+			 * 聚合支付
+			 * 判断vuex中是否存在openId
+			 * 存在直接调起微信支付
+			 * 不存在则通过微信登录去获取用户的code
+			 * 完成后通过code去获取用户的openId等信息
+			 * 最后再调起微信支付
+			 * */
+			juhePay() {
+				this.getWXPayByJava(this.curOrderList, this.deviceNo);
+			},
+			/**
+			 * 微信支付
+			 */
+			wechatPay() {
+				this.$u.api
+					.wechatPayApi({
+						orderList: this.curOrderList,
+						openid: this.vuex_wxinfo.openId,
+						deviceNo: this.deviceNo || undefined,
+						payeeId: this.payeeId || undefined,
+						payeeName: this.payeeName || undefined
+					})
+					.then((res) => {
+						if (res.code === 200) {
+							$wxPay.wexinPay(res.data.wx).then((res1) => {
+								switch (Number(res1.code)) {
+									case 0: // 成功
+										//#ifdef H5
+										window.location.reload();
+										//#endif
+										break;
+									case 1: // 取消
+										this.$refs.uToast.show({
+											title: '已取消支付',
+											type: 'info'
+										});
+										break;
+									case 2: // 支付失败
+										this.$refs.uToast.show({
+											title: '支付失败,请检查!',
+											type: 'error'
+										});
+										break;
+								}
+							});
+						}
+					});
+			},
+			/**
+			 * 直接通过后台获取贵阳银行微信支付地址
+			 * @param {Array} list 需要支付的订单组合数组
+			 * @param {Number} deviceNo 设备编号(在停车锁部分需要)
+			 * */
+			getWXPayByJava(orderList, deviceNo) {
+				let params = {
+					orderList: orderList,
+					openid: '',
+					jumpUrl: this.jumpUrl,
+					deviceNo: deviceNo ? deviceNo : null,
+					payeeId: this.payeeId,
+					payeeName: this.payeeName
+				};
+				this.$u.api
+					.ordinaryWxPay(params)
+					.then((res) => {
+						if (res.code === 200) {
+							// if (getEnvIsWx()) {
+							// 	location.href = res.data.qrCodeUrl + '&jump_url=' + encodeURIComponent(this.jumpUrl)
+							// } else {
+							// 	location.href = res.data.qrCodeUrl
+							// }
+							localStorage.setItem('jumpUrl', this.jumpUrl);
+							location.href = res.data.qrCodeUrl;
+						} else {
+							uni.hideLoading();
+						}
+					})
+					.catch((err) => {
+						this.$refs.uToast.show({
+							title: '无法调起微信支付!',
+							type: 'error'
+						});
+					});
+			},
+			/**
+			 * 关闭弹框
+			 * */
+			closePaymentMethod() {
+				this.$emit('closePaymentMethod');
+			}
+		}
+	};
 </script>
 
 <style lang="scss" scoped>
-	@import './paymentMethod.scss'
+	@import './paymentMethod.scss';
 </style>

+ 35 - 4
utils/filter.js

@@ -22,6 +22,31 @@ Vue.filter("timestamp", function(link) {
 	return link + '?t=' + new Date().getTime();
 });
 
+//截取第一张照片且判断是否有图片,没有图片输入默认图片
+Vue.filter("firstImg",function(arr,sizeType,imgType){
+	//图片类型判断
+	if(arr){
+		if(arr instanceof Array){
+			img = arr[0]
+		}else{
+			img = arr.split(',')[0]
+		}
+	}else if(!arr){
+		//如果没有图片则随机输出一张
+		// if(imgType === 'farmer'){
+		// 	const farmerList = ['carbon2/farmer/1.png','carbon2/farmer/2.png']
+		// 	img = farmerList[Math.floor(Math.random() * farmerList.length)];
+		// }
+		// img = '/static/img/inbuild.png'
+	}
+	// return config.imgUrl + img;
+	return img;
+});
+
+//七牛云压缩图片
+Vue.filter("miniImg",function(img,quality){
+	return img+'?imageMogr2/quality/'+quality
+});
 
 //单位米m转换为单位千米km,提醒:传递参数不要带引号,如kmUnit('100')会返回0m。
 Vue.filter("kmUnit", function(m) {
@@ -101,8 +126,14 @@ Vue.filter("energyTpye", function(value) {
 
 });
 
-// 免费时长 
-Vue.filter("freeDuration", function(value) {
-	return '0天0时30分0秒';
-
+// 免费时长
+Vue.filter("freeDuration", function(value){
+	console.log(value);
+	let createTime = new Date(value).valueOf(),
+	freeTime = new Date('2022-06-20 00:00:00').valueOf(),
+	freeTxt = '0天0时15分0秒'
+	if (createTime > freeTime) {
+		freeTxt = '0天0时30分0秒'
+	}
+	return freeTxt
 });