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