|
@@ -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.carLicense.value | 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,50 @@
|
|
<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'
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
|
|
+ startTime:'',
|
|
|
|
+ endTime:'',
|
|
|
|
+ payUrl:'',
|
|
|
|
+ monthId: '',
|
|
|
|
+ vehicleNo:'',
|
|
|
|
+ monthEndTime:'',
|
|
|
|
+ monthStartTime:'',
|
|
|
|
+ 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");
|
|
|
|
+ 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,12 +87,15 @@
|
|
* {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()
|
|
|
|
+ const hours = Date1.getHours();
|
|
|
|
+ const minutes = Date1.getMinutes();
|
|
|
|
+ const seconds = Date1.getSeconds();
|
|
let days = new Date(year, month, 0)
|
|
let days = new Date(year, month, 0)
|
|
days = days.getDate() //获取当前日期中的月的天数
|
|
days = days.getDate() //获取当前日期中的月的天数
|
|
let year2 = year;
|
|
let year2 = year;
|
|
@@ -87,7 +104,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) {
|
|
@@ -98,6 +115,10 @@
|
|
}
|
|
}
|
|
const t1 = year + '.' + (month > 9 ? month : '0' + month) + '.' + (day > 9 ? day : '0' + day)
|
|
const t1 = year + '.' + (month > 9 ? month : '0' + month) + '.' + (day > 9 ? day : '0' + day)
|
|
const t2 = year2 + '.' + month2 + '.' + day2
|
|
const t2 = year2 + '.' + month2 + '.' + day2
|
|
|
|
+ this.startTime=t1
|
|
|
|
+ this.endTime=t2
|
|
|
|
+ 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
|
|
return t1 + '-' + t2
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
@@ -113,31 +134,101 @@
|
|
* 月操作 加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) {
|
|
|
|
+ console.log('this.carLicenseList',this.carLicenseList);
|
|
|
|
+ console.log('item',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 => {
|
|
|
|
+ if (res.code === 200){
|
|
|
|
+ this.lastActiveDate = res.data.lastActiveDate;
|
|
|
|
+ this.form.monthAmount=res.data.monthAmount;
|
|
|
|
+ this.carLicenseList = [];
|
|
|
|
+ res.data.vehicleList.forEach(item => {
|
|
|
|
+ const obj = {
|
|
|
|
+ value: item.energyType,
|
|
|
|
+ label: item.vehicleNo,
|
|
|
|
+ energyType:item.energyType
|
|
}
|
|
}
|
|
|
|
+ this.carLicenseList.push(obj)
|
|
|
|
+ });
|
|
|
|
+ console.log('this.carLicenseList',this.carLicenseList)
|
|
|
|
+ this.form.carLicense = this.carLicenseList[0]
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ submit(roadNo){
|
|
|
|
+ // console.log(this.monthStartTime)
|
|
|
|
+ // console.log('this.form.carLicense',this.form.carLicense);
|
|
|
|
+ this.$u.api.createMonth({
|
|
|
|
+ roadNo:this.roadNo,
|
|
|
|
+ vehicleNo:this.form.carLicense.label,
|
|
|
|
+ energyType:this.form.carLicense.energyType,
|
|
|
|
+ monthStartTime:this.monthStartTime,
|
|
|
|
+ monthEndTime:this.monthEndTime,
|
|
|
|
+ monthCount:this.form.month})
|
|
|
|
+ .then(res => {
|
|
|
|
+ console.log("createMonth",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
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ this.$refs.uToast.show({
|
|
|
|
+ title: res.msg,
|
|
|
|
+ type: 'warning',
|
|
|
|
+ });
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ }).catch(err=>{
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ // 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>
|