瀏覽代碼

包月信息接口

tianhui 3 年之前
父節點
當前提交
d4aa652fc8
共有 4 個文件被更改,包括 99 次插入43 次删除
  1. 8 0
      common/apiurl.js
  2. 10 1
      common/http.api.js
  3. 80 41
      pages/handleMonthly/handleMonthly.vue
  4. 1 1
      pages/parkingLists/parkingLists.vue

+ 8 - 0
common/apiurl.js

@@ -41,6 +41,14 @@ const apiurl = {
 	nearRoadslUrl:'/roadinfo/nearRoads',
 	nearRoadslUrl:'/roadinfo/nearRoads',
 	// 获取路段收费规则
 	// 获取路段收费规则
 	roadsChargeRuleUrl:'/roadinfo/feeRule/',
 	roadsChargeRuleUrl:'/roadinfo/feeRule/',
+	//包月信息
+	monthInfoUrl:'/memberinfo/monthInfo/',
+	//创建包月
+	createMonthUrl:'/memberinfo/createMonth',
+	//包月支付
+	monthPayUrl:'/monthpay/gzbank/quick',
+	//包月支付查询
+	getMonthPayUrl:'/monthpay/query/',
 	
 	
 	//贵州银行快捷支付
 	//贵州银行快捷支付
 	payGzbankUrl: '/pay/gzbank/quick',
 	payGzbankUrl: '/pay/gzbank/quick',

+ 10 - 1
common/http.api.js

@@ -39,6 +39,11 @@ const install = (Vue, vm) => {
 	let nearRoadsl = (params = {}) => vm.$u.post(apiurl.nearRoadslUrl,params);
 	let nearRoadsl = (params = {}) => vm.$u.post(apiurl.nearRoadslUrl,params);
 	let roadChargeRule = (params = {}) => vm.$u.get(apiurl.roadsChargeRuleUrl + params.roadNo);
 	let roadChargeRule = (params = {}) => vm.$u.get(apiurl.roadsChargeRuleUrl + params.roadNo);
 	
 	
+	let monthInfo = (params = {}) => vm.$u.get(apiurl.monthInfoUrl,params)
+	let createMonth = (params = {}) => vm.$u.post(apiurl.createMonthUrl, params);
+	let monthPay = (params = {}) => vm.$u.post(apiurl.monthPayUrl, params);
+	let getMonthPay = (params = {}) => vm.$u.get(apiurl.getMonthPayUrl + params.id);
+	
 	let payGzbank = (params = {}) => vm.$u.post(apiurl.payGzbankUrl, params);
 	let payGzbank = (params = {}) => vm.$u.post(apiurl.payGzbankUrl, params);
 	
 	
 	//贵州银行支付
 	//贵州银行支付
@@ -68,7 +73,11 @@ const install = (Vue, vm) => {
 		nearRoadsl,
 		nearRoadsl,
 		roadChargeRule,
 		roadChargeRule,
 		getMessageList,
 		getMessageList,
-		payGzbank
+		payGzbank,
+		monthInfo,
+		createMonth,
+		monthPay,
+		getMonthPay
 	};
 	};
 }
 }
 
 

+ 80 - 41
pages/handleMonthly/handleMonthly.vue

@@ -10,11 +10,11 @@
 		<u-select v-model="isShowCarLicense" :list="carLicenseList" @confirm="carLicenseListConfirm"></u-select>
 		<u-select v-model="isShowCarLicense" :list="carLicenseList" @confirm="carLicenseListConfirm"></u-select>
 		<view class="handle-monthly-item">
 		<view class="handle-monthly-item">
 			<view>车辆信息</view>
 			<view>车辆信息</view>
-			<view>汽油车</view>
+			<view>{{form.energyType| verifyStatusFilter}}</view>
 		</view>
 		</view>
 		<view class="handle-monthly-item">
 		<view class="handle-monthly-item">
 			<view>包月金额</view>
 			<view>包月金额</view>
-			<view class="handle-monthly-money">200元</view>
+			<view class="handle-monthly-money">{{form.monthAmount}}元</view>
 		</view>
 		</view>
 		<view class="handle-monthly-item">
 		<view class="handle-monthly-item">
 			<view>包月时长</view>
 			<view>包月时长</view>
@@ -26,7 +26,7 @@
 		</view>
 		</view>
 		<view class="handle-monthly-item">
 		<view class="handle-monthly-item">
 			<view>包期</view>
 			<view>包期</view>
-			<view>{{form.dateRange}}</view>
+			<view>{{dateRange}}</view>
 		</view>
 		</view>
 		<view class="handle-monthly-explain">
 		<view class="handle-monthly-explain">
 			<view>包月说明</view>
 			<view>包月说明</view>
@@ -35,36 +35,44 @@
 			<view>3、月卡会员在有效期内停车免费</view>
 			<view>3、月卡会员在有效期内停车免费</view>
 		</view>
 		</view>
 		<view class="handle-monthly-confirm-button">
 		<view class="handle-monthly-confirm-button">
-			<button type="default">确认包月</button>
+			<button type="default"@click="submit(roadNo)">确认包月</button>
 		</view>
 		</view>
+		<u-toast ref="uToast" />
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
+	import getUrlParams from "../../utils/getUrlParams.js";
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
-				carLicenseList: [
-					{
-						value: 1, label: '贵AWE45T'
-					},
-					{
-						value: 2, label: '贵AWE45F'
-					},
-				],
+				lastActiveDate:null,
+				roadNo:null,
+				carLicenseList: [],
 				isShowCarLicense: false,
 				isShowCarLicense: false,
 				form: {
 				form: {
-					carLicense: {
-						value: 2,
-						label: '贵AWE45F'
-					},
+					energyType:[],
+					monthAmount: [],
+					carLicense: {},
 					month: 1,
 					month: 1,
-					dateRange: this.getMonthRange(new Date(), 1)
-				}
+					dateRange:""
+				},
+				label:""
 			}
 			}
 		},
 		},
-		onLoad () {
-			this.getCarsLicenseList()
+		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.getMonthInfo(this.roadNo);
+			// this.form.dateRange=this.getMonthRange(this.lastActiveDate,1)
+			// this.getCarsLicenseList();
+			
+		},
+		mounted(){
+			// console.log(this.lastActiveDate)
+			// this.form.dateRange=this.getMonthRange(new Date(this.lastActiveDate),1)
 		},
 		},
 		methods: {
 		methods: {
 			/**
 			/**
@@ -73,11 +81,11 @@
 			  * {monthNum} Number  往后月数 
 			  * {monthNum} Number  往后月数 
 			  * */
 			  * */
 			getMonthRange (date, monthNum) {
 			getMonthRange (date, monthNum) {
-				let Date1 = new Date(date)
-				Date1 = Date1.valueOf() + 24 * 60 * 60 * 1000
+				let Date1 = this.lastActiveDate;
+				// Date1 = Date1.valueOf() + 24 * 60 * 60 * 1000
 				Date1 = new Date(Date1)
 				Date1 = new Date(Date1)
 				const year = Date1.getFullYear()
 				const year = Date1.getFullYear()
-				const month = Date1.getMonth()
+				const month = Date1.getMonth()+1
 				const day = Date1.getDate()
 				const day = Date1.getDate()
 				let days = new Date(year, month, 0)
 				let days = new Date(year, month, 0)
 				days = days.getDate() //获取当前日期中的月的天数
 				days = days.getDate() //获取当前日期中的月的天数
@@ -87,7 +95,7 @@
 					year2 = parseInt(year2) + parseInt((parseInt(month2) / 12 == 0 ? 1 : parseInt(month2) / 12))
 					year2 = parseInt(year2) + parseInt((parseInt(month2) / 12 == 0 ? 1 : parseInt(month2) / 12))
 					month2 = parseInt(month2) % 12;
 					month2 = parseInt(month2) % 12;
 				}
 				}
-				const day2 = day;
+				let day2 = day;
 				let days2 = new Date(year2, month2, 0)
 				let days2 = new Date(year2, month2, 0)
 				days2 = days2.getDate()
 				days2 = days2.getDate()
 				if (day2 > days2) {
 				if (day2 > days2) {
@@ -113,31 +121,62 @@
 			 * 月操作 加1
 			 * 月操作 加1
 			  * */
 			  * */
 			addMonthNum () {
 			addMonthNum () {
+				if(this.form.month >=24){
+					this.$refs.uToast.show({
+						title: '最多24月',
+						type: 'warning',
+					})
+					return 
+				}
 				this.form.month += 1
 				this.form.month += 1
+				
 				this.form.dateRange = this.getMonthRange(new Date, this.form.month)
 				this.form.dateRange = this.getMonthRange(new Date, this.form.month)
 			},
 			},
 			carLicenseListConfirm (item) {
 			carLicenseListConfirm (item) {
 				this.form.carLicense = item[0]
 				this.form.carLicense = item[0]
 			},
 			},
-			getCarsLicenseList () {
-				this.$u.api.getMycars()
-					.then(res => {
-						console.log(res)
-						if (res.code === 200) {
-							if (res.data) {
-								this.carLicenseList = []
-								res.data.rows.forEach(item => {
-									const obj = {
-										value: item.id,
-										label: item.vehicleNo
-									}
-									this.carLicenseList.push(obj)
-								})
-								this.form.carLicense = this.carLicenseList[0]
+			getMonthInfo(roadNo){
+				this.$u.api.monthInfo({roadNo: this.roadNo})
+				.then(res => {
+					console.log('getMonthInfo',res)
+					if (res.code === 200){
+						this.lastActiveDate = res.data.lastActiveDate;
+						this.form.energyType=res.data.vehicleList[0].energyType;
+						this.form.monthAmount=res.data.monthAmount;
+						this.carLicenseList = [];
+						res.data.vehicleList.forEach(item => {
+							const obj = {
+								value: item.id,
+								label: item.vehicleNo
 							}
 							}
-						}
-					})
+							this.carLicenseList.push(obj)
+						})
+						this.form.carLicense = this.carLicenseList[0]
+					}
+				})
+			},
+			submit(roadNo){
+				// this.$u.api.createMonth({roadNo:})
+				// this.getMonthInfo(roadNo)
 			}
 			}
+		},
+		computed:{
+			dateRange:function(){
+				return this.getMonthRange(this.lastActiveDate,this.form.month)
+			}
+		},
+		filters:{
+			verifyStatusFilter(value) {
+				if (value === 0) {
+				  return '';
+				} else if(value === 1){
+					return '汽油车';				
+				} else if(value === 2){
+					return '新能源';				
+				} else {
+				  return '';
+				}
+			},
 		}
 		}
 	}
 	}
 </script>
 </script>

+ 1 - 1
pages/parkingLists/parkingLists.vue

@@ -46,7 +46,7 @@
 						</view>
 						</view>
 						<view class="swiper-item-button">
 						<view class="swiper-item-button">
 							<button type="default" @click="navigation(item.latitude, item.longitude)">导航</button>
 							<button type="default" @click="navigation(item.latitude, item.longitude)">导航</button>
-							<button type="default" :disabled="!item.monthAmount" :class="{'disabled': !item.monthAmount}" @click="$u.route({url: 'pages/handleMonthly/handleMonthly'})">办理包月</button>
+							<button type="default" :disabled="!item.monthAmount" :class="{'disabled': !item.monthAmount}" @click="createMonth(item)">办理包月</button>
 						</view>
 						</view>
 						<view @click="lookParkingRule(item)">
 						<view @click="lookParkingRule(item)">
 							<text>点击查看停车规则</text>
 							<text>点击查看停车规则</text>