Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {CalendarComponentOptions} from "ion2-calendar";
import {monthCh, weekDay} from "../../../app/main";
import {ServeService} from "../serve.service";
import {DatePipe} from "@angular/common";
import {RoomApplyPage} from "../meet-room/room-apply/room-apply";
import {AppGlobal} from "../../../service/http.service";
import {CommonService} from "../../../provide/common.service";
import {CarApplyPage} from "./car-apply/car-apply";
options: CalendarComponentOptions = {
from: new Date(2000, 0, 1),
monthFormat: 'YYYY 年 MM 月 ',
weekdays: weekDay,
monthPickerFormat: monthCh,
pickMode: 'single',
color: 'danger'
};
pageNumber = 1;
pageSize = AppGlobal.pageCount;
total;
isLoad = true;
constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, public datePipe: DatePipe,
private commonSer: CommonService, private appMainSer: AppMainService) {
}
//获取权限
this.appMainSer.role.subscribe(value => {
this.role = value;
}
);
//获取个人信息
this.appMainSer.mineInfo.subscribe(value => {
this.mineInfo = value;
})
this.checkObj.checkedApplyList = res.data.checkedApplyList;
this.checkObj.uncheckApplyist = res.data.uncheckApplyist;
doRefresh(e){
this.getApply();
const data = {
P_pageNumber: 1,
P_pageSize: this.pageSize,
};
this.serveSer.myCarApply(data).subscribe(
(res) => {
this.isLoad = false;
this.applyList = res.data.list;
this.total = res.data.total;
timer(800).subscribe(() => e.complete());
}
)
}
doInfinite(e){
//我的预定
myApply() {
const data = {
P_pageNumber: this.pageNumber,
P_pageSize: this.pageSize,
this.applyList = res.data.list;
this.total = res.data.total;
if(item.startTime < new Date().getTime()){
this.commonSer.toast("已过期不可取消");
return;
}
(res) => {
if (res.errcode == 1000) {
this.commonSer.toast('取消预定成功');
this.myApply();
} else {
this.commonSer.toast(res.errmsg);
}
}
)
}
if (this.changeType == 1) this.getApply();
if (this.changeType == 2) this.myApply();
}
//新增申请
goApply() {
this.navCtrl.push(RoomApplyPage);
}