yangzj преди 2 години
родител
ревизия
a7a3f5356b

+ 18 - 13
README.md

@@ -1,13 +1,18 @@
-## 城市智慧停车(二期)
-### 打包注意
-- 发行 => 自定义发行 => build:dev(测试环境) / build:pro (正式环境)
-- 如果api地址有变动   修改package.json 中的环境变量配置
-- common/config.js  本地运行地址修改
-- 新项目中的点金计划页面修改static/html/wxPayCallback.html中(jumpOutUrl)修改为需要跳转的页面
-
-#### iconfont
-- [iconfont 自定义图标](https://www.uviewui.com/guide/customIcon.html)
-- [字体默认不再生成 .eot、.svg 和 Base64](https://github.com/thx/iconfont-plus/issues/1948)
-
-#### 安装vue-jsonp
-`npm install vue-jsonp --save` 用作通过经纬度获取所在城市跨域处理
+## 城市智慧停车
+
+### 修改访问地址
+- 如果api地址有变动 修改package.json 中的环境变量配置
+- common/config.js 本地运行地址修改
+- 项目中的点金计划页面修改static/html/wxPayCallback.html中(jumpOutUrl)修改为需要跳转的页面
+
+### 打包
+- 打包测试环境: 发行 => 自定义发行 => build:test
+- 打包正式环境: 发行 => 自定义发行 => build:pro
+
+### 执行 `npm install`
+
+#### 安装vue-jsonp 获取地址数据跨域处理
+`npm install vue-jsonp --save`
+
+#### 安装weixin-js-sdk 微信支付
+`npm install weixin-js-sdk --save`

+ 6 - 4
common/config.js

@@ -4,15 +4,17 @@
  * 只有在打包环境下才会有H_NODE_ENV
  */
 const node_dev = process.env.H_NODE_ENV
-let baseUrl = 'https://wx.hw.hongweisoft.com/parking'
+let baseUrl = 'https://wx.hw.hongweisoft.com/parking',
+wxAppid = 'wx6e9cdf7a0ee8a51b'
+console.log(process.env.H_BASE_URL);
 if (node_dev) {
-	baseUrl = process.env.H_BASE_URL
+	baseUrl = process.env.H_BASE_URL,
+	wxAppid = process.env.H_WXAPPID
 }
 const config = {
-	wxAppid: 'wx45c3cf2b632f5fd5',
+	wxAppid,
 	baseUrl
 }
-
 export {
 	config
 }

+ 3 - 0
manifest.json

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

+ 33 - 9
package-lock.json

@@ -1,11 +1,35 @@
 {
-  "requires": true,
-  "lockfileVersion": 1,
-  "dependencies": {
-    "vue-jsonp": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
-      "integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA=="
-    }
-  }
+	"name": "parking_h5",
+	"lockfileVersion": 2,
+	"requires": true,
+	"packages": {
+		"": {
+			"dependencies": {
+				"vue-jsonp": "^2.0.0",
+				"weixin-js-sdk": "^1.6.0"
+			}
+		},
+		"node_modules/vue-jsonp": {
+			"version": "2.0.0",
+			"resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
+			"integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA=="
+		},
+		"node_modules/weixin-js-sdk": {
+			"version": "1.6.0",
+			"resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.0.tgz",
+			"integrity": "sha512-3IYQH7aalJGFJrwdT3epvTdR1MboMiH7vIZ5BRL2eYOJ12BNah7csoMkmSZzkq1+l92sSq29XdTCVjCJoK2sBQ=="
+		}
+	},
+	"dependencies": {
+		"vue-jsonp": {
+			"version": "2.0.0",
+			"resolved": "https://registry.npmjs.org/vue-jsonp/-/vue-jsonp-2.0.0.tgz",
+			"integrity": "sha512-Mzd9GNeuKP5hHFDWZNMWOsCuMILSkA6jo2l4A02wheFz3qqBzH7aSEFTey1BRCZCLizlaf1EqJ5YUtF392KspA=="
+		},
+		"weixin-js-sdk": {
+			"version": "1.6.0",
+			"resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.0.tgz",
+			"integrity": "sha512-3IYQH7aalJGFJrwdT3epvTdR1MboMiH7vIZ5BRL2eYOJ12BNah7csoMkmSZzkq1+l92sSq29XdTCVjCJoK2sBQ=="
+		}
+	}
 }

+ 6 - 0
package.json

@@ -7,6 +7,7 @@
 					"UNI_PLATFORM": "h5",
 					"H_NODE_ENV": "development",
 					"H_BASE_URL": "https://wx.hw.hongweisoft.com/parking",
+					"H_WXAPPID": "wx6e9cdf7a0ee8a51b",
 					"DESCRIBE": "测试环境"
 				}
 			},
@@ -16,9 +17,14 @@
 					"UNI_PLATFORM": "h5",
 					"H_NODE_ENV": "production",
 					"H_BASE_URL": "https://parking.pdzhtc.com",
+					"H_WXAPPID": "wx45c3cf2b632f5fd5",
 					"DESCRIBE": "正式环境"
 				}
 			}
 		}
+	},
+	"dependencies": {
+		"vue-jsonp": "^2.0.0",
+		"weixin-js-sdk": "^1.6.0"
 	}
 }

+ 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,

+ 2 - 2
pages/favourableActivity/favourableActivity.vue

@@ -7,7 +7,7 @@
 				<view>使用贵州银行支付可一分钱停车</view>
 				<view>从客户启用贵州银行行卡支付的第四个月开始,使用我行卡支付永久享受八折优惠(单日不限次数)。时间计算同上。三个月最后一天,假如车主跨天的话,拆分账单计算:三个月内一分钱或八折,三个月外时段八折。
 				</view>
-				<view>如果停车场、路边停车位有15分钟内等免费政策的,我行客户自然享受后再按“一分钱停车”、“八折停车”执行。</view>
+				<view>如果停车场、路边停车位有30分钟内等免费政策的,我行客户自然享受后再按“一分钱停车”、“八折停车”执行。</view>
 				<view>
 					<button type="default" class="btn1" @click="openAcount">银行卡开户</button>
 				</view>
@@ -19,7 +19,7 @@
 				<view>使用贵州银行支付可享永久八折优惠</view>
 				<view>从客户启用贵州银行行卡支付的第四个月开始,使用我行卡支付永久享受八折优惠(单日不限次数)。时间计算同上。三个月最后一天,假如车主跨天的话,拆分账单计算:三个月内一分钱或八折,三个月外时段八折。
 				</view>
-				<view>如果停车场、路边停车位有15分钟内等免费政策的,我行客户自然享受后再按“一分钱停车”、“八折停车”执行。</view>
+				<view>如果停车场、路边停车位有30分钟内等免费政策的,我行客户自然享受后再按“一分钱停车”、“八折停车”执行。</view>
 				<view>
 					<button type="default" class="btn2" @click="openAcount">银行卡开户</button>
 				</view>

+ 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 需要支付的订单组合数组

+ 28 - 10
pages/paymentMethod/paymentMethod.scss

@@ -17,26 +17,26 @@
 }
 .pay-way-new {
 	display: flex;
-	justify-content: space-between;
-	width: calc(100% - 80rpx);
+	justify-content: space-around;
+	width: calc(100% - 60rpx);
 	border-top: solid 1px #979797;
-	margin: 23rpx auto;
-	padding: 36rpx 0;
+	margin: 23rpx auto 0;
+	padding: 36rpx 0 10rpx;
 	.pay-way-item {
-		width: calc(50% - 9rpx);
+		width: calc(33% - 9rpx);
 		border-radius: 20rpx;
 		text-align: center;
 		padding: 30rpx 0;
 		image {
-			width: 159rpx;
-			height: 159rpx;
+			width: 110rpx;
+			height: 110rpx;
 		}
 		.title {
-			font-size: 30rpx;
+			font-size: 28rpx;
 			font-weight: 400;
 			font-family: 'PingFangSC-Regular, PingFang SC';
 			color: #fff;
-			margin: 15rpx 0;
+			margin: 10rpx 0;
 		}
 		.subtitle {
 			font-size: 14rpx;
@@ -49,9 +49,27 @@
 	.pay-way-item-hy {
 		background: linear-gradient(153deg, #FA9460 0%, #FF5065 100%)
 	}
-	.pay-way-item-jh {
+	.pay-way-item-wx {
 		background: linear-gradient(155deg, #5EE3A6 0%, #3EB9C8 100%);
 	}
+	.pay-way-item-jh {
+		background: linear-gradient(155deg, #5AA6FF 0%, #C782FF 100%);
+	}
+}
+.pay-way-subtitle {
+	display: flex;
+	justify-content: space-around;
+	width: calc(100% - 60rpx);
+	margin: 0 auto 60rpx;
+	&-item {
+		width: calc(33% - 9rpx);
+		border-radius: 20rpx;
+		text-align: center;
+		font-size: 20rpx;
+		font-weight: 400;
+		font-family: 'PingFangSC-Regular, PingFang SC';
+		opacity: 0.73;
+	}
 }
 .pay-way-close-btn {
 	width: calc(100% - 80rpx);

+ 23 - 1
template.h5.html

@@ -3,8 +3,12 @@
 	<head>
 		<meta charset="utf-8">
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
+		<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+		<meta http-equiv="Pragma" content="no-cache" />
+		<meta http-equiv="Expires" content="0" />
 		<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico">
-		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+		<meta name="viewport"
+			content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
 		<title>
 			<%= htmlWebpackPlugin.options.title %>
 		</title>
@@ -12,6 +16,24 @@
 			document.addEventListener('DOMContentLoaded', function() {
 				document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
 			})
+			window.addEventListener(
+				"error",
+				function(e) {
+					var jsLoadedErrorReload = window.sessionStorage.getItem(
+						"jsLoadedErrorReload" // 跳转的标识,存入sessionStorage。用于不可控情况下,防止一直满足条件,触发死循环性的跳转页面
+					);
+					const fileReg = /\/js\/((chunk-vendors)|(app))\.[a-zA-Z0-9]+/;
+					const filename = e.filename || e.target.src || "";
+					if (jsLoadedErrorReload !== "true" && filename.match(fileReg)) {
+						window.sessionStorage.setItem("jsLoadedErrorReload", true); // 满足条件则,存入标识
+						let url = window.location.href;
+						const timeStr = `timeStr=${Date.now()}`;
+						url = /\?/.test(url) ? url + "&" + timeStr : url + "?" + timeStr;
+						window.location.replace(url); // 跳转时添加了时间戳
+					}
+				},
+				true
+			);
 		</script>
 		<link rel="stylesheet" href="<%= BASE_URL %>static/index.css" />
 	</head>

+ 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
 });