tianhui %!s(int64=3) %!d(string=hai) anos
pai
achega
a57026e512
Modificáronse 3 ficheiros con 80 adicións e 5 borrados
  1. 9 0
      pages.json
  2. 42 5
      pages/handleMonthly/handleMonthly.vue
  3. 29 0
      pages/handleMonthly/monthPay.vue

+ 9 - 0
pages.json

@@ -142,6 +142,15 @@
 		        "navigationBarTitleText":"支付"
 		    }
 		    
+		},
+		{
+		    "path" : "pages/handleMonthly/monthPay",
+		    "style" :                                                                                    
+		    {
+		        "navigationStyle":"custom",// 隐藏系统导航栏
+		        "navigationBarTitleText":"包月支付"
+		    }
+		    
 		},
 		{
 		    "path" : "pages/searchparking/searchparking",

+ 42 - 5
pages/handleMonthly/handleMonthly.vue

@@ -46,6 +46,11 @@
 	export default {
 		data() {
 			return {
+				payUrl:'',
+				monthId: '',
+				vehicleNo:'',
+				monthEndTime:'',
+				monthStartTime:'',
 				lastActiveDate:null,
 				roadNo:null,
 				carLicenseList: [],
@@ -63,8 +68,7 @@
 		onLoad (page) {
 			let locationLocaturl = window.location.hash;
 			// this.roadNo = this.$u.queryParams(page).slice();
-			this.roadNo = getUrlParams(locationLocaturl,"roadNo"); 
-			console.log("roadNo" ,this.roadNo)
+			this.roadNo = getUrlParams(locationLocaturl,"roadNo");
 			this.getMonthInfo(this.roadNo);
 			// this.form.dateRange=this.getMonthRange(this.lastActiveDate,1)
 			// this.getCarsLicenseList();
@@ -87,6 +91,9 @@
 				const year = Date1.getFullYear()
 				const month = Date1.getMonth()+1
 				const day = Date1.getDate()
+				const hours = Date1.getHours();
+				const minutes = Date1.getMinutes();
+				const seconds = Date1.getSeconds();
 				let days = new Date(year, month, 0)
 				days = days.getDate() //获取当前日期中的月的天数
 				let year2 = year;
@@ -106,6 +113,8 @@
 				}
 				const t1 = year + '.' + (month > 9 ? month : '0' + month) + '.' + (day > 9 ? day : '0' + day)
 				const t2 = year2 + '.' + month2 + '.' + day2
+				this.monthStartTime=year + '-' + (month > 9 ? month : '0' + month) + '-' + (day > 9 ? day : '0' + day) + ' ' + hours + ':' + minutes + ':' +seconds
+				this.monthEndTime=year2 + '-' + month2 + '-' + day2 + ' ' + hours + ':' + minutes + ':' +seconds
 				return t1 + '-' + t2
 			},
 			/**
@@ -138,8 +147,8 @@
 			getMonthInfo(roadNo){
 				this.$u.api.monthInfo({roadNo: this.roadNo})
 				.then(res => {
-					console.log('getMonthInfo',res)
 					if (res.code === 200){
+						this.vehicleNo = res.data.vehicleList[0].vehicleNo
 						this.lastActiveDate = res.data.lastActiveDate;
 						this.form.energyType=res.data.vehicleList[0].energyType;
 						this.form.monthAmount=res.data.monthAmount;
@@ -156,14 +165,42 @@
 				})
 			},
 			submit(roadNo){
-				// this.$u.api.createMonth({roadNo:})
+				// console.log(this.monthStartTime)
+				this.$u.api.createMonth({
+					roadNo:this.roadNo,
+					vehicleNo:this.form.carLicense.label,
+					energyType:this.form.energyType,
+					monthStartTime:this.monthStartTime,
+					monthEndTime:this.monthEndTime,
+					monthCount:this.form.monthAmount})
+					.then(res => {
+						console.log("1111",res)
+						if(res.code === 200){
+							this.monthId = res.data.monthId
+							console.log(this.monthId)
+							this.$u.api.monthPay({
+								monthId:this.monthId
+							}).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.getMonthInfo(roadNo)
 			}
 		},
 		computed:{
 			dateRange:function(){
 				return this.getMonthRange(this.lastActiveDate,this.form.month)
-			}
+			},
 		},
 		filters:{
 			verifyStatusFilter(value) {

+ 29 - 0
pages/handleMonthly/monthPay.vue

@@ -0,0 +1,29 @@
+<template>
+	<view>
+		<a ref="payUrlRef" :href="PayUrl"></a>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				PayUrl: "",
+			};
+		},
+		onLoad(page) {
+			// console.log('page',page);
+			// console.log('page1',this.$u.queryParams(page).slice(0));
+			//15是因为传了‘currentPayUrl’,不要更改参数名
+			this.PayUrl = this.$u.queryParams(page).slice(8);
+		},
+		mounted() {
+			// console.log('this.PayUrl',this.PayUrl);
+			// console.log('this.$refs.payUrlRef',this.$refs.payUrlRef);
+			this.$refs.payUrlRef.click();
+		}
+	}
+</script>
+
+<style>
+</style>